From 88e0b8f6fa3c543959a6b91c6615c6fb65572cae Mon Sep 17 00:00:00 2001 From: Leo Tenenbaum Date: Sun, 10 Nov 2019 11:47:01 -0500 Subject: improved some integer type stuff --- eval.c | 2 +- parse.c | 2 +- types.h | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/eval.c b/eval.c index 61a56de..b367ac1 100644 --- a/eval.c +++ b/eval.c @@ -1171,7 +1171,7 @@ static bool eval_expr(Evaluator *ev, Expression *e, Value *v) { } break; case EXPR_LITERAL_INT: assert(e->type.kind == TYPE_BUILTIN); - u64_to_val(v, e->type.builtin, e->intl); + u64_to_val(v, e->type.builtin, (U64)e->intl); break; case EXPR_LITERAL_FLOAT: assert(e->type.kind == TYPE_BUILTIN); diff --git a/parse.c b/parse.c index c3cf7fb..83ef2fe 100644 --- a/parse.c +++ b/parse.c @@ -191,7 +191,7 @@ static size_t type_to_str_(Type *t, char *buffer, size_t bufsize) { case TYPE_ARR: { size_t written = str_copy(buffer, bufsize, "["); if (t->flags & TYPE_IS_RESOLVED) { - snprintf(buffer + written, bufsize - written, UINTEGER_FMT, t->arr.n); + snprintf(buffer + written, bufsize - written, PRIu64, t->arr.n); written += strlen(buffer + written); } else { written += str_copy(buffer + written, bufsize - written, "N"); diff --git a/types.h b/types.h index ed88db2..acf7bc0 100644 --- a/types.h +++ b/types.h @@ -316,8 +316,8 @@ typedef struct Type { struct { struct Type *of; union { - UInteger n; /* this is NOT set by parse_type; it will be handled by types.c */ - struct Expression *n_expr; + U64 n; /* after typing */ + struct Expression *n_expr; /* before typing */ }; } arr; struct Type *ptr; -- cgit v1.2.3