summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2019-11-10 11:47:01 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2019-11-10 11:47:01 -0500
commit88e0b8f6fa3c543959a6b91c6615c6fb65572cae (patch)
tree1ae517acd5e720c350fd94bcdfb783365497a6c7
parent99185ed75bba6c14a996ccf5b6b1b98b823eac0f (diff)
improved some integer type stuff
-rw-r--r--eval.c2
-rw-r--r--parse.c2
-rw-r--r--types.h4
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;