Nicolas Cannasse 2 years ago
parent
commit
86414873cf
2 changed files with 4 additions and 3 deletions
  1. 1 1
      src/allocator.c
  2. 3 2
      src/allocator.h

+ 1 - 1
src/allocator.c

@@ -157,7 +157,7 @@ static gc_pheader *gc_allocator_new_page( int pid, int block, int size, int kind
 	if( p->max_blocks > GC_PAGE_SIZE )
 		hl_fatal("Too many blocks for this page");
 	if( varsize ) {
-		if( p->max_blocks <= 8 )
+		if( p->max_blocks <= SIZES_PADDING )
 			p->sizes = (unsigned char*)&p->sizes_ref;
 		else {
 			p->sizes = ph->base + start_pos;

+ 3 - 2
src/allocator.h

@@ -13,6 +13,8 @@ typedef struct _gc_freelist {
 	gc_fl *data;
 } gc_freelist;
 
+#define SIZES_PADDING 8
+
 typedef struct {
 	int block_size;
 	unsigned char size_bits;
@@ -22,7 +24,6 @@ typedef struct {
 	// mutable
 	gc_freelist free;
 	unsigned char *sizes;
-	int sizes_ref;
-	int sizes_ref2;
+	char sizes_ref[SIZES_PADDING];
 } gc_allocator_page_data;