Fixed comparison of registers

This commit is contained in:
Devine Lu Linvega 2024-04-06 09:36:30 -07:00
parent 05a3c1b30f
commit 92bc8e2f4c
2 changed files with 6 additions and 7 deletions

View File

@ -1,5 +1,4 @@
<> (a) (apple) <> (eq ?x ?x) (#t)
<> (b) (banana) <> (eq ?x ?y) (#f)
<> (apple banana) (fruit salad)
a b (eq foo bar) (eq foo foo)

View File

@ -36,7 +36,7 @@ static int
compare(char *a, char *b) compare(char *a, char *b)
{ {
int i = 0, al = walk(a) - a, bl = walk(b) - b; int i = 0, al = walk(a) - a, bl = walk(b) - b;
if(al != bl) if(al != bl) return 0;
while(a[i] == b[i]) while(a[i] == b[i])
if(!a[i] || ++i >= al) return 1; if(!a[i] || ++i >= al) return 1;
return 0; return 0;