Skip to content

Commit

Permalink
update tiny/lisp.c for 64-bit
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffBezanson committed Oct 12, 2012
1 parent 2bc8ab3 commit 71a1cb6
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tiny/lisp.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,13 @@
#include <ctype.h>
#include <sys/types.h>

#ifdef __LP64__
typedef u_int64_t value_t;
typedef int64_t number_t;
#else
typedef u_int32_t value_t;
typedef int32_t number_t;
#endif

typedef struct {
value_t car;
Expand Down Expand Up @@ -496,7 +501,7 @@ void print(FILE *f, value_t v)
value_t cd;

switch (tag(v)) {
case TAG_NUM: fprintf(f, "%d", numval(v)); break;
case TAG_NUM: fprintf(f, "%ld", numval(v)); break;
case TAG_SYM: fprintf(f, "%s", ((symbol_t*)ptr(v))->name); break;
case TAG_BUILTIN: fprintf(f, "#<builtin %s>",
builtin_names[intval(v)]); break;
Expand Down Expand Up @@ -558,7 +563,7 @@ value_t eval_sexpr(value_t e, value_t *penv)
lerror("eval: error: variable %s has no value\n", sym->name);
return v;
}
if ((unsigned)(char*)&nargs < (unsigned)stack_bottom || SP>=(N_STACK-100))
if ((unsigned long)(char*)&nargs < (unsigned long)stack_bottom || SP>=(N_STACK-100))
lerror("eval: error: stack overflow\n");
saveSP = SP;
PUSH(e);
Expand Down

0 comments on commit 71a1cb6

Please sign in to comment.