1 /* Wrapper functions for malloc/free that force 16-byte alignment
2 * See http://perso.club-internet.fr/matmac/sourcesc.htm
4 * Copyright 2001 Phil Karn, KA9Q
5 * May be used under the terms of the GNU Public License (GPL)
11 void *malloc16Align(int size){
15 if((p = malloc(size+31)) == NULL)
18 /* Round up to next 16-byte boundary */
19 p1 = (void **)(((long)p + 31) & (~15));
21 /* Stash actual start of block just before ptr we return */
24 /* Return 16-byte aligned address */
28 void *calloc16Align(size_t nmemb,size_t size){
33 if((p = malloc16Align(nbytes)) == NULL)
40 void free16Align(void *p){
43 /* Retrieve pointer to actual start of block and free it */
44 free(((void **)p)[-1]);