summaryrefslogtreecommitdiff
path: root/mem.h
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2024-08-06 18:12:16 +0100
committerubq323 <ubq323@ubq323.website>2024-08-06 18:12:16 +0100
commit5b522325bdc0af283ca6d3ec7d71908858d91b33 (patch)
treee2944b3db088fbb4b48dac71365928c628ef30dd /mem.h
parenta266b97829ebe698a4256890fdf1214e479fe1de (diff)
deastnodeify form compilers
Diffstat (limited to 'mem.h')
-rw-r--r--mem.h8
1 files changed, 2 insertions, 6 deletions
diff --git a/mem.h b/mem.h
index e7edb82..84fa4bb 100644
--- a/mem.h
+++ b/mem.h
@@ -17,16 +17,12 @@ void *M(State *S, void *ptr, size_t old, size_t new);
#define ENSURE_CAP(S, darr, type, needed) \
if (darr.cap < needed) { \
size_t __newsz = next_pwrof2(needed); \
- if (__newsz < 8) __newsz = 8;
+ if (__newsz < 8) __newsz = 8; \
darr.d = RENEW_ARR(S, darr.d, type, darr.cap, __newsz); \
darr.cap = __newsz; \
}
-inline size_t next_pwrof2(size_t x) {
- size_t p = 1;
- while (p < x) p <<= 1;
- return p;
-}
+size_t next_pwrof2(size_t x);
#define FREE(S,p,ty) M(S, p, sizeof(ty), 0)
#define FREE_ARR(S,p,ty,old) M(S, p, (old)*sizeof(ty), 0)