Last active 1 week ago

scratch.cpp Raw
1inline Arena *get_scratch(Arena **conflicts, u64 count) {
2 if (!g_thread_ctx.scratch_arenas[0]) {
3 thread_ctx_init();
4 }
5 for (u64 i = 0; i < 2; i++) {
6 bool has_conflict = false;
7 for (u64 j = 0; j < count; j++) {
8 if (g_thread_ctx.scratch_arenas[i] == conflicts[j]) {
9 has_conflict = true;
10 break;
11 }
12 }
13 if (!has_conflict) {
14 return g_thread_ctx.scratch_arenas[i];
15 }
16 }
17 TRAP();
18}