diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-03-14 13:50:24 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-03-14 13:50:24 -0400 |
| commit | 6f70286a4be2bfaa6a2dc9314b72518db930333a (patch) | |
| tree | 8fa61455ff2bd60fff4f3a9a6eee31183a6354da /builtins | |
| parent | 80ffb8044ab60cedfe2ce1c3025419c282cb0965 (diff) | |
Clean up codegen to not use macros
Diffstat (limited to 'builtins')
| -rw-r--r-- | builtins/macros.h | 12 |
1 files changed, 0 insertions, 12 deletions
diff --git a/builtins/macros.h b/builtins/macros.h index 6f9af8c9..09896b0d 100644 --- a/builtins/macros.h +++ b/builtins/macros.h @@ -14,15 +14,3 @@ #define $stack(x) (__typeof(x)*)((__typeof(x)[1]){x}) #define $tagged(obj_expr, type_name, tag_name) ({ __typeof(obj_expr) $obj = obj_expr; \ $obj.$tag == $tag$##type_name##$##tag_name ? &$obj.tag_name : NULL; }) - - -#define Bool(x) _Generic(x, bool: (bool)(x), int64_t: (x != 0), int32_t: (x != 0), int16_t: (x != 0), int8_t: (x != 0), CORD: ((x) == CORD_EMPTY), \ - array_t: ((x).length > 0), table_t: ((x).entries.length > 0), CORD: ((x) != CORD_EMPTY), \ - default: _Static_assert(0, "Not supported")) -#define and(x, y) _Generic(x, bool: (bool)((x) && (y)), default: ((x) & (y))) -#define or(x, y) _Generic(x, bool: (bool)((x) || (y)), default: ((x) | (y))) -#define xor(x, y) _Generic(x, bool: (bool)((x) ^ (y)), default: ((x) ^ (y))) -#define mod(x, n) ((x) % (n)) -#define mod1(x, n) (((x) % (n)) + (__typeof(x))1) -#define $cmp(x, y, info) (_Generic(x, int8_t: (x>0)-(y>0), int16_t: (x>0)-(y>0), int32_t: (x>0)-(y>0), int64_t: (x>0)-(y>0), bool: (x>0)-(y>0), \ - CORD: CORD_cmp((CORD)x, (CORD)y), char*: strcmp((char*)x, (char*)y), default: generic_compare($stack(x), $stack(y), info))) |
