shithub: femtolisp

Download patch

ref: 2e99f52b29df7b7e7c6ea59f3ffc3f305e2478c3
parent: 1649e64ad399a68e3ba72012b88795154c2ec251
author: JeffBezanson <[email protected]>
date: Fri Feb 5 14:56:10 EST 2010

adding dependency on equal.c in makefiles
adding a missing va_end
minor change to hash function


--- a/femtolisp/Makefile
+++ b/femtolisp/Makefile
@@ -25,8 +25,8 @@
 %.do: %.c
 	$(CC) $(DEBUGFLAGS) -c $< -o $@
 
-flisp.o: flisp.c cvalues.c types.c flisp.h print.c read.c
-flisp.do: flisp.c cvalues.c types.c flisp.h print.c read.c
+flisp.o:  flisp.c cvalues.c types.c flisp.h print.c read.c equal.c
+flisp.do: flisp.c cvalues.c types.c flisp.h print.c read.c equal.c
 
 $(LLT):
 	cd $(LLTDIR) && make
--- a/femtolisp/Makefile.macosx
+++ b/femtolisp/Makefile.macosx
@@ -25,8 +25,8 @@
 %.do: %.c
 	$(CC) $(DEBUGFLAGS) -c $< -o $@
 
-flisp.o: flisp.c cvalues.c types.c flisp.h print.c read.c
-flisp.do: flisp.c cvalues.c types.c flisp.h print.c read.c
+flisp.o:  flisp.c cvalues.c types.c flisp.h print.c read.c equal.c
+flisp.do: flisp.c cvalues.c types.c flisp.h print.c read.c equal.c
 
 $(LLT):
 	cd $(LLTDIR) && make
--- a/femtolisp/equal.c
+++ b/femtolisp/equal.c
@@ -329,7 +329,7 @@
         }
         len = vector_size(a);
         for(i=0; i < len; i++) {
-            h = MIX(h, bounded_hash(vector_elt(a,i), bound/2, &oob2)+1);
+            h = MIX(h, bounded_hash(vector_elt(a,i), bound/2, &oob2)^1);
             if (oob2)
                 bound/=2;
             *oob = *oob || oob2;
@@ -354,7 +354,7 @@
             *oob = *oob || oob2;
             a = cdr_(a);
         } while (iscons(a));
-        h = MIX(h, bounded_hash(a, bound-1, &oob2)+2);
+        h = MIX(h, bounded_hash(a, bound-1, &oob2)^2);
         *oob = *oob || oob2;
         return h;
     }
--- a/femtolisp/flisp.c
+++ b/femtolisp/flisp.c
@@ -659,6 +659,7 @@
     }
     value_t v = _applyn(n);
     POPN(n+1);
+    va_end(ap);
     return v;
 }