Changeset 30
- Timestamp:
- 12/04/06 18:19:12 (2 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 2 modified
-
Properties.js (added)
-
Properties.js/Properties.js (added)
-
libapool/apool.c (modified) (1 diff)
-
libapool/apool.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/libapool/apool.c
r28 r30 11 11 12 12 char *ram = chunk->chunk = calloc(blocks, blocksize); 13 void *stack = pool->stack; 13 14 14 /* Stack must be able to hold atleast all available items */15 free(pool->stack);16 15 pool->blocks += blocks; 17 16 pool->stack = calloc(pool->blocks, sizeof(void *)); 17 18 /* Copy from the old stack to the new stack pool->pos bytes */ 19 apool_copy(pool->stack, stack, pool->pos); 20 free(stack); 18 21 19 22 /* Use the ram in reverse order */ -
trunk/libapool/apool.h
r29 r30 16 16 #define apool_double(pool) apool_expand(pool, pool->blocks) 17 17 #define apool_empty(pool) (pool->pos == 0) 18 /* Duff's device copy...this is more optimized than while (*to++ = *from++) 19 * It determines an offset for the total copy, jumps to the offset for the 20 * first iteration and then continues to copy 8 bytes at a time until the end 21 * of len is met. 22 */ 23 #define apool_copy(dest, src, len) \ 24 char *to = dest; \ 25 register int n = (len + 7) / 8; \ 26 switch (len % 8) { \ 27 case 0: \ 28 do { *to++ = *from++; \ 29 case 7: *to++ = *from++; \ 30 case 6: *to++ = *from++; \ 31 case 5: *to++ = *from++; \ 32 case 4: *to++ = *from++; \ 33 case 3: *to++ = *from++; \ 34 case 2: *to++ = *from++; \ 35 case 1: *to++ = *from++; \ 36 } while (--n > 0); \ 37 } 18 38 19 39 extern apool * apool_new (size_t blocks, size_t blocksize);