aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-02-10 18:37:41 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-02-10 18:37:41 -0500
commit4ed28b5b100414c8b1f6566deb6e80a16fe001c2 (patch)
tree8966dc2529fa550eb40b404f22123194877b3ccc
parentb099d51d2b0305295518522313ec3b594c66331f (diff)
Rename taggedunion in builtins
-rw-r--r--builtins/types.c16
-rw-r--r--builtins/types.h4
2 files changed, 10 insertions, 10 deletions
diff --git a/builtins/types.c b/builtins/types.c
index 965bb067..56826b59 100644
--- a/builtins/types.c
+++ b/builtins/types.c
@@ -38,8 +38,8 @@ public uint32_t generic_hash(const void *obj, const TypeInfo *type)
halfsiphash(hash_values, sizeof(uint32_t)*info.members.length, SSS_HASH_VECTOR, (uint8_t*)&hash, sizeof(hash));
return hash;
}
- case TaggedUnionInfo: {
- auto info = type->TaggedUnionInfo;
+ case EnumInfo: {
+ auto info = type->EnumInfo;
int32_t tag = *(int32_t*)obj;
int64_t offset = 4;
typedef struct { int64_t tag; const char *name; const TypeInfo *type;} tu_member_t;
@@ -95,8 +95,8 @@ public int32_t generic_compare(const void *x, const void *y, const TypeInfo *typ
}
return 0;
}
- case TaggedUnionInfo: {
- auto info = type->TaggedUnionInfo;
+ case EnumInfo: {
+ auto info = type->EnumInfo;
int32_t xtag = *(int32_t*)x,
ytag = *(int32_t*)y;
@@ -146,8 +146,8 @@ public bool generic_equal(const void *x, const void *y, const TypeInfo *type)
}
return true;
}
- case TaggedUnionInfo: {
- auto info = type->TaggedUnionInfo;
+ case EnumInfo: {
+ auto info = type->EnumInfo;
int32_t xtag = *(int32_t*)x,
ytag = *(int32_t*)y;
@@ -256,8 +256,8 @@ public CORD generic_cord(const void *obj, bool colorize, const TypeInfo *type)
CORD_sprintf(&c, colorize ? "\x1b[1m%s\x1b[m%r" : "%s%r", type->name, c);
return c;
}
- case TaggedUnionInfo: {
- auto info = type->TaggedUnionInfo;
+ case EnumInfo: {
+ auto info = type->EnumInfo;
int32_t tag = *(int32_t*)obj;
int64_t offset = 4;
typedef struct { int64_t tag; const char *name; const TypeInfo *type;} tu_member_t;
diff --git a/builtins/types.h b/builtins/types.h
index 72f78846..960098b9 100644
--- a/builtins/types.h
+++ b/builtins/types.h
@@ -17,7 +17,7 @@ typedef struct TypeInfo {
const char *name;
int64_t size, align;
struct { // Anonymous tagged union for convenience
- enum { CustomInfo, PointerInfo, ArrayInfo, TableInfo, StructInfo, TaggedUnionInfo } tag;
+ enum { CustomInfo, PointerInfo, ArrayInfo, TableInfo, StructInfo, EnumInfo } tag;
union {
struct {
equal_fn_t equal;
@@ -42,7 +42,7 @@ typedef struct TypeInfo {
} StructInfo;
struct {
array_t members; // [{tag, name, type}]
- } TaggedUnionInfo;
+ } EnumInfo;
};
};
} TypeInfo;