comparison runtime/fixed_alloc.c @ 92:e73a93fb5de1

Beginning of port of compiler to itself, some bugfixes and a refcount optimization
author Mike Pavone <pavone@retrodev.com>
date Mon, 02 Aug 2010 00:58:55 -0400
parents 5a195ee08eac
children 43cc42df26cc
comparison
equal deleted inserted replaced
91:bcdc326b3d6e 92:e73a93fb5de1
1 #include "fixed_alloc.h" 1 #include "fixed_alloc.h"
2 #include <stdlib.h> 2 #include <stdlib.h>
3 #include <string.h> 3 #include <string.h>
4 #include <stdio.h> 4 #include <stdio.h>
5 5
6 uint16_t max_free[(MAX_SIZE-MIN_SIZE)/STRIDE]; 6 uint16_t max_free[(MAX_SIZE-MIN_SIZE)/STRIDE+1];
7 7
8 void fixed_alloc_init() 8 void fixed_alloc_init()
9 { 9 {
10 int i; 10 int i;
11 for(i = 0; i < (MAX_SIZE-MIN_SIZE)/STRIDE; ++i) 11 for(i = 0; i < ((MAX_SIZE-MIN_SIZE)/STRIDE+1); ++i)
12 max_free[i] = (BLOCK_SIZE - sizeof(mem_block)+1)*8/((i*STRIDE+MIN_SIZE)*8+1); 12 max_free[i] = (BLOCK_SIZE - sizeof(mem_block)+1)*8/((i*STRIDE+MIN_SIZE)*8+1);
13 } 13 }
14 14
15 mem_manager * new_mem_manager() 15 mem_manager * new_mem_manager()
16 { 16 {