From 0f7cf28af1b204d0f979dd7b97133329f16ffe55 Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Wed, 11 Sep 2024 22:50:03 -0400 Subject: Fix threads and integers --- builtins/integers.h | 12 ++++++------ compile.c | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/builtins/integers.h b/builtins/integers.h index 4f3ebe51..4a6416c1 100644 --- a/builtins/integers.h +++ b/builtins/integers.h @@ -23,9 +23,9 @@ #define I16(x) ((int16_t)x) #define I8(x) ((int8_t)x) -#define DEFINE_INT_TYPE(c_type, type_name, bits) \ +#define DEFINE_INT_TYPE(c_type, type_name) \ typedef struct { \ - c_type i:bits; \ + c_type i; \ bool is_null:1; \ } Optional ## type_name ## _t; \ Text_t type_name ## $as_text(const c_type *i, bool colorize, const TypeInfo *type); \ @@ -63,10 +63,10 @@ return type_name ## $modulo(D-1, d) + 1; \ } -DEFINE_INT_TYPE(int64_t, Int64, 64) -DEFINE_INT_TYPE(int32_t, Int32, 32) -DEFINE_INT_TYPE(int16_t, Int16, 16) -DEFINE_INT_TYPE(int8_t, Int8, 8) +DEFINE_INT_TYPE(int64_t, Int64) +DEFINE_INT_TYPE(int32_t, Int32) +DEFINE_INT_TYPE(int16_t, Int16) +DEFINE_INT_TYPE(int8_t, Int8) #undef DEFINE_INT_TYPE #define NULL_INT64 ((OptionalInt64_t){.is_null=true}) diff --git a/compile.c b/compile.c index 8d017a42..f5ed809d 100644 --- a/compile.c +++ b/compile.c @@ -324,6 +324,8 @@ static CORD optional_var_into_nonnull(binding_t *b) case IntType: return CORD_all(b->code, ".i"); case StructType: + if (t == THREAD_TYPE) + return b->code; return CORD_all(b->code, ".value"); default: return b->code; -- cgit v1.2.3