On 2007-08-16 at 05:41:08 [+0200], Bryan Varner <bryan@xxxxxxxxxxxxx> wrote: > > The main problem I'm having is with the memory allocation method. > > Basically what seems to be needed is a way to allocate memory in a > > nice aligned chunk. One way to do this is with the function > > posix_memalign: > > > > > http://www.opengroup.org/onlinepubs/000095399/functions/posix_memalign.html > > > > Haiku doesn't seem to implement this. The relevant bit of code is here: > > This function should do the trick. > haiku/headers/posix/malloc.h:20 > extern void *memalign(size_t alignment, size_t numBytes); > > > http://pastie.caboo.se/88124 > > I think something like... > > #elif PLATFORM(HAIKU) > void *address = memalign(BLOCK_SIZE, BLOCK_SIZE); > memset(reinterpret_cast<void*>(address), 0, BLOCK_SIZE); > #else > ... > > might just do the trick. The memset() is not necessary according to the specification. But instead of adding a special case to your port, rather add a posix_memalign() implementation to Haiku. The prototype goes to malloc.h, the implementation to src/system/libroot/posix/malloc/wrapper.cpp. CU, Ingo