- return (pool_object *) (uintptr_t) p;
-}
-
-static inline bool
-IS_VALID_POOL_OBJECT (pool_object * p)
-{
- pool_ptr pp = (pool_ptr) (uintptr_t) p;
- return (uintptr_t) pp == (uintptr_t) p;
-}
-
-static inline pool_ptr
-POOL_PTR (pool_object * p)
-{
- pool_ptr pp = (pool_ptr) (uintptr_t) p;
- assert (IS_VALID_POOL_OBJECT (p));
- return pp;
-}
-
-// TODO make (heap_ptr)0 nullish
-static inline object *
-OBJECT_OF_HEAP_PTR (heap_ptr p)
-{
- assert (p >= 0);
- return (object *) (vhp_base + (p << 4));
-}
-
-static inline pool_object *
-pool_alloc (uint32_t len)
-{
- char *pp = pool;
- pool += (len << 4);
- return (pool_object *) pp;
-}
-
-static inline heap_ptr
-HEAP_PTR_OF_OBJECT (object * p)
-{
- assert ((uintptr_t) p >= (uintptr_t) vhp_base);
- heap_ptr h = (heap_ptr) ((uintptr_t) p - (uintptr_t) vhp_base);
- return h;
-}
-
-static inline object *
-heap_alloc (uint32_t len)
-{
- enum
- { DOPE_LEN = 1 };
- char *p = vhp;
- vhp += (len + DOPE_LEN) << 4;
- return (object *) p;
+ // divide by 2 (rounding up), then add one for dope
+ return heap_alloc (((len + 1) >> 1) + 1);