From 2bdae52fed2ac0845ebb24348f3834dbc63f6d34 Mon Sep 17 00:00:00 2001 From: gingerBill Date: Sun, 3 Oct 2021 11:53:32 +0100 Subject: 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 --- src/common.cpp | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) (limited to 'src/common.cpp') 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; -- cgit v1.2.3