@@ -118,14 +118,7 @@ void alloc_heap(Heap * h, size_t heap_size, size_t growth, char * old)
118118 }
119119
120120 h->heap = mem;
121−#ifdef FORCE_ALIGNMENT
122− if (((i_int)(h->heap)&1) == 1) {
123− h->next = h->heap + 1;
124− } else
125−#endif
126− {
127− h->next = h->heap;
128− }
121+ h->next = aligned_heap_pointer(h->heap);
129122 h->end = h->heap + heap_size;
130123
131124 h->size = heap_size;
@@ -169,6 +162,17 @@ int ref_in_heap(Heap * heap, VAL v) {
169162 return ((VAL)heap->heap <= v) && (v < (VAL)heap->next);
170163}
171164
165+char* aligned_heap_pointer(char * heap) {
166+#ifdef FORCE_ALIGNMENT
167+ if (((i_int)heap&1) == 1) {
168+ return (heap + 1);
169+ } else
170+#endif
171+ {
172+ return heap;
173+ }
174+}
175+
172176// Checks three important properties:
173177// 1. Closure.
174178// Check if all pointers in the _heap_ points only to heap.