delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/08/21/20:45:13

From: Nate Eldredge <neldredge AT hmc DOT edu>
Newsgroups: comp.os.msdos.djgpp
Subject: Re: memory aligning
Date: 21 Aug 2000 16:55:32 -0700
Organization: Posted via Supernews, http://www.supernews.com
Lines: 21
Sender: nate AT mercury DOT bitbucket
Message-ID: <83zom6kw3v.fsf@mercury.bitbucket>
References: <39A14127 DOT 23939 DOT 1349953 AT localhost> <39A24687 DOT 5636 DOT B1C5E AT localhost>
X-Complaints-To: newsabuse AT supernews DOT com
User-Agent: Gnus/5.0802 (Gnus v5.8.2) Emacs/20.5
MIME-Version: 1.0
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

Leon AT caresystems DOT com DOT au writes:

> > If you are asking about malloc, it returns memory aligned on 8-byte
> > boundaries.
> > 
> > > 2) how does one do it?
> > 
> > Do what?
> 
> sorry how would one align memory to something other than 8 bytes (eg
> 128 bytes)

Place it at an address that's a multiple of 128.  If you allocate a
buffer of size 127+yoursize, and round up the returned address to the
nearest multiple of 128, you will have at least yoursize bytes
available at that address. 

-- 

Nate Eldredge
neldredge AT hmc DOT edu

- Raw text -


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