summaryrefslogtreecommitdiff
path: root/mem.c
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.c
parenta266b97829ebe698a4256890fdf1214e479fe1de (diff)
deastnodeify form compilers
Diffstat (limited to 'mem.c')
-rw-r--r--mem.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/mem.c b/mem.c
index 225834d..2c42758 100644
--- a/mem.c
+++ b/mem.c
@@ -22,3 +22,10 @@ Obj *alloc_obj(State *S, size_t sz, ObjTy oty) {
o->oty = oty;
return o;
}
+
+
+size_t next_pwrof2(size_t x) {
+ size_t p = 1;
+ while (p < x) p <<= 1;
+ return p;
+}