aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-09-11 22:50:03 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-09-11 22:50:03 -0400
commit0f7cf28af1b204d0f979dd7b97133329f16ffe55 (patch)
treed1674b27d5e93e08a35c81988f35fbfec11f10e3
parent62408e4efcfac85d4c835242391aae761c2313eb (diff)
Fix threads and integersoptionals
-rw-r--r--builtins/integers.h12
-rw-r--r--compile.c2
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;