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
This commit is contained in:
gingerBill
2021-10-03 11:53:32 +01:00
parent b3a66b3950
commit 2bdae52fed
7 changed files with 145 additions and 13 deletions

View File

@@ -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;