Computer Chess Club Archives


Search

Terms

Messages

Subject: Re: Aligned malloc on cygwin (Tord)

Author: Mathieu Pagé

Date: 09:17:41 02/18/05

Go up one level in this thread


On February 18, 2005 at 11:15:09, Dieter Buerssner wrote:

>Perhaps, I don't understand. Why not something like:
>
>#define ALIGNMENT 1024
>
>  p = malloc(nbytes + ALIGNMENT-1);
>  paligned = ((char *)p + ALIGNMENT-1)& ~(ALIGNMENT-1);
>
>You cannot hide it conveniently in a function, because yo'll need to remember p
>for the free call.

If you did use C++ it could be efficiently enclosed in a class. You can probably
do something similar with C using structs.

Mathieu P.



This page took 0 seconds to execute

Last modified: Thu, 15 Apr 21 08:11:13 -0700

Current Computer Chess Club Forums at Talkchess. This site by Sean Mintz.