diff options
| author | gingerBill <bill@gingerbill.org> | 2021-10-03 11:53:32 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2021-10-03 11:53:32 +0100 |
| commit | 2bdae52fed2ac0845ebb24348f3834dbc63f6d34 (patch) | |
| tree | 02b05813607d403681bbf41443eafcaa510e430b /src/common.cpp | |
| parent | b3a66b3950283853ce99a7da71ad8f1850fba0d8 (diff) | |
Add @(init) attribute for procedures, allowing for procedures to be called at startup
These procedures will be called after global variables have been initialized as normal
Diffstat (limited to 'src/common.cpp')
| -rw-r--r-- | src/common.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/common.cpp b/src/common.cpp index 3216a8725..0b622eea4 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -47,6 +47,39 @@ void debugf(char const *fmt, ...); #include "range_cache.cpp" +int isize_cmp(isize x, isize y) { + if (x < y) { + return -1; + } else if (x > y) { + return +1; + } + return 0; +} +int u64_cmp(u64 x, u64 y) { + if (x < y) { + return -1; + } else if (x > y) { + return +1; + } + return 0; +} +int i64_cmp(i64 x, i64 y) { + if (x < y) { + return -1; + } else if (x > y) { + return +1; + } + return 0; +} +int i32_cmp(i32 x, i32 y) { + if (x < y) { + return -1; + } else if (x > y) { + return +1; + } + return 0; +} + u32 fnv32a(void const *data, isize len) { u8 const *bytes = cast(u8 const *)data; u32 h = 0x811c9dc5; |