Article View: comp.sys.amiga.tech
Article #13819Re: The Long Align Struct Macro D_S
From: Doug Merritt
Date: Wed, 21 Feb 1990 08:08
Date: Wed, 21 Feb 1990 08:08
28 lines
1658 bytes
1658 bytes
In article <1990Feb19.151157.21042@csmil.umich.edu> root@csmil.umich.edu (Zurich Operator) writes:
>-------------
>A few weeks ago somone posted a little macro that could be used in place of
>the AllocMem() function to long align structures for use with Amigados commands
>like Examine. I lost my copy of this macro when I upgraded to Manx 5.0
>If you have a copy or remember it, I would be most greatful.
I don't think that was me that time (I've been posting this from time to
time for years, and I'm certainly not the only one), but here's my
version:
/*
* RoundUp0(N,T) -- yields ceiling 1,2,...,T-1,0 (yields 0 if n % T == 0)
* BufRound(BUF) -- given buffer address, rounds up to word boundary
*/
#define RoundUp0(N,T) ( (T - (((ULONG) N) & (T-1))) & (T-1))
#define BufRound(BUF) &BUF[ RoundUp0(BUF,4) ]
/* example usage: */
char buf[ sizeof(struct FileInfoBlock) + 4];
ptr = (struct FileInfoBlock *) BufRound(buf);
---------------------- End of A.F. Drill :-) --------------------------
Doug
--
Doug Merritt {pyramid,apple}!xdos!doug
Member, Crusaders for a Better Tomorrow Professional Wildeyed Visionary
Technical Details
Message-ID:
<669@xdos.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!apple!motcsd!xdos!dougReferences:
<1990Feb19.151157.21042@csmil.umich.edu>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!cs.utexas.edu!usc!brutus.cs.uiuc.edu!apple!motcsd!xdos!doug From: doug@xdos.UUCP (Doug Merritt) Newsgroups: comp.sys.amiga.tech Subject: Re: The Long Align Struct Macro D_S Keywords: Long word align, diskInfo struct BCPL Message-ID: <669@xdos.UUCP> Date: 21 Feb 90 08:08:17 GMT References: <1990Feb19.151157.21042@csmil.umich.edu> Reply-To: doug@xdos.UUCP (Doug Merritt) Organization: Hunter Systems, Mountain View CA (Silicon Valley) Lines: 28