From 2e99f52b29df7b7e7c6ea59f3ffc3f305e2478c3 Mon Sep 17 00:00:00 2001 From: JeffBezanson Date: Fri, 5 Feb 2010 19:56:10 +0000 Subject: [PATCH] adding dependency on equal.c in makefiles adding a missing va_end minor change to hash function --- femtolisp/Makefile | 4 ++-- femtolisp/Makefile.macosx | 4 ++-- femtolisp/equal.c | 4 ++-- femtolisp/flisp.c | 1 + 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/femtolisp/Makefile b/femtolisp/Makefile index 5182893..6c72984 100644 --- a/femtolisp/Makefile +++ b/femtolisp/Makefile @@ -25,8 +25,8 @@ test: %.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 diff --git a/femtolisp/Makefile.macosx b/femtolisp/Makefile.macosx index b02ed91..e13090f 100644 --- a/femtolisp/Makefile.macosx +++ b/femtolisp/Makefile.macosx @@ -25,8 +25,8 @@ test: %.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 diff --git a/femtolisp/equal.c b/femtolisp/equal.c index c953364..a01bf2e 100644 --- a/femtolisp/equal.c +++ b/femtolisp/equal.c @@ -329,7 +329,7 @@ static uptrint_t bounded_hash(value_t a, int bound, int *oob) } 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 @@ static uptrint_t bounded_hash(value_t a, int bound, int *oob) *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; } diff --git a/femtolisp/flisp.c b/femtolisp/flisp.c index 83ef151..16ec57e 100644 --- a/femtolisp/flisp.c +++ b/femtolisp/flisp.c @@ -659,6 +659,7 @@ value_t applyn(uint32_t n, value_t f, ...) } value_t v = _applyn(n); POPN(n+1); + va_end(ap); return v; }