scripts

misc scripts and tools
git clone git://git.2f30.org/scripts
Log | Files | Refs

commit ebc73d6c19da9bc785a5c48eccc5098691cb7bdb
parent 245780e4083ab07eef6b3d76a26c5b8306a6653c
Author: sin <sin@2f30.org>
Date:   Fri,  2 Aug 2013 11:42:32 +0100

Allocate rbtree nodes with a 16 byte alignment

Diffstat:
Mrandom/rballoc.c | 8+++++---
1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/random/rballoc.c b/random/rballoc.c @@ -84,11 +84,13 @@ alloc_object(size_t siz) { void *p; - sd.base = sbrk(siz); + sd.base = sbrk(siz + MINALIGNMENT); if (sd.base == (void *)-1) return NULL; - sd.siz += siz; - return sd.base; + sd.siz += siz + MINALIGNMENT; + p = sd.base; + p = (void *)(((uintptr_t)p + MINALIGNMENT) & ~(MINALIGNMENT - 1)); + return p; } static void *