www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/1999/08/07/14:08:34

Sender: nate AT cartsys DOT com
Message-ID: <37AC6FF0.91231064@cartsys.com>
Date: Sat, 07 Aug 1999 10:42:08 -0700
From: Nate Eldredge <nate AT cartsys DOT com>
X-Mailer: Mozilla 4.08 [en] (X11; I; Linux 2.2.10 i586)
MIME-Version: 1.0
To: djgpp-workers AT delorie DOT com
Subject: Re: Data Alignment for Optimal Access
References: <Pine DOT SUN DOT 3 DOT 91 DOT 990805165952 DOT 10909F-100000 AT is>
Reply-To: djgpp-workers AT delorie DOT com

In a thread from djgpp AT delorie DOT com

Eli Zaretskii wrote:
> 
> On Thu, 5 Aug 1999, Duncan Coutts wrote:


> > Dynamic storage seems the only other possibility.
> > The new operator aligns allocations to 4 byte boundaries.
> 
> Are you sure?  malloc aligns on 8-byte boundary, so how come new doesn't?

Reminds me that I'd been wondering about implementing `memalign' for
DJGPP.  I think it's a BSD invention.

The glibc manual documents it as:

 - Function: void * memalign (size_t BOUNDARY, size_t SIZE)
     The `memalign' function allocates a block of SIZE bytes whose
     address is a multiple of BOUNDARY.  The BOUNDARY must be a power
     of two!  The function `memalign' works by allocating a somewhat
     larger block, and then returning an address within the block that
     is on the specified boundary.

and also the special case `valloc', where `valloc(n)' ==
`memalign(getpagesize(), n)'.




-- 

Nate Eldredge
nate AT cartsys DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019