diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-02-17 19:32:30 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-02-17 19:32:30 -0500 |
| commit | d46925dbfa8627a6a874545630c2acb6975bfdea (patch) | |
| tree | 2b726ea50adf91b668a24b25d4d9e6ec7f7c2663 /builtins/integers.c | |
| parent | 7355b2f7fe6f5dda2aee8feca025350146ccd0f5 (diff) | |
Cleanup of builtins
Diffstat (limited to 'builtins/integers.c')
| -rw-r--r-- | builtins/integers.c | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/builtins/integers.c b/builtins/integers.c index e89de0c3..36e7d7a8 100644 --- a/builtins/integers.c +++ b/builtins/integers.c @@ -7,11 +7,10 @@ #include "../SipHash/halfsiphash.h" #include "array.h" +#include "integers.h" #include "types.h" #include "string.h" -extern const void *SSS_HASH_VECTOR; - #define xstr(a) str(a) #define str(a) #a @@ -48,15 +47,7 @@ extern const void *SSS_HASH_VECTOR; uint32_t r = arc4random_uniform((uint32_t)range); \ return min + (c_type)r; \ } \ - public struct { \ - TypeInfo type; \ - c_type min, max; \ - c_type (*abs)(c_type i); \ - CORD (*format)(c_type i, int64_t digits); \ - CORD (*hex)(c_type i, int64_t digits, bool uppercase, bool prefix); \ - CORD (*octal)(c_type i, int64_t digits, bool prefix); \ - c_type (*random)(int64_t min, int64_t max); \ - } KindOfInt##_type = { \ + public KindOfInt##_namespace_t KindOfInt##_type = { \ .type={ \ .size=sizeof(c_type), \ .align=alignof(c_type), \ @@ -72,9 +63,10 @@ extern const void *SSS_HASH_VECTOR; .random=KindOfInt##__random, \ }; -DEFINE_INT_TYPE(int64_t, Int, "ld", labs, INT64_MIN, INT64_MAX); +DEFINE_INT_TYPE(int64_t, Int64, "ld", labs, INT64_MIN, INT64_MAX); DEFINE_INT_TYPE(int32_t, Int32, "d_i32", abs, INT32_MIN, INT32_MAX); DEFINE_INT_TYPE(int16_t, Int16, "d_i16", abs, INT16_MIN, INT16_MAX); DEFINE_INT_TYPE(int8_t, Int8, "d_i8", abs, INT8_MIN, INT8_MAX); +#undef DEFINE_INT_TYPE // vim: ts=4 sw=0 et cino=L2,l1,(0,W4,m1,\:0 |
