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)
12 void *malloc16Align(int size){
16 if((p = malloc(size+31)) == NULL)
19 /* Round up to next 16-byte boundary */
20 p1 = (void **)(((long)p + 31) & (~15));
22 /* Stash actual start of block just before ptr we return */
25 /* Return 16-byte aligned address */
29 void *calloc16Align(size_t nmemb,size_t size){
34 if((p = malloc16Align(nbytes)) == NULL)
41 void free16Align(void *p){
44 /* Retrieve pointer to actual start of block and free it */
45 free(((void **)p)[-1]);