Subject: Re: ancillary data alignment and binary backward compatibility
To: None <itojun@iijlab.net>
From: Chris G. Demetriou <cgd@netbsd.org>
List: tech-net
Date: 03/07/2000 09:36:33
itojun@iijlab.net writes:
> >> > - is hardcoded sizeof(long) alignment okay?
> >>Use the ALIGN() macro.
> > IIRC ALIGN() was not usable for this, does not capture sparc64 case
> > or something (maybe my memory is wrong).
>
> I was wrong. ALIGNBYTES in sparc64 looks okay.
> ALIGNBYTES looks more correct than sizeof(long) - 1. anyway, i'll
> try to introduce sysctl for it...
Why is this a good thing to have a sysctl for?
* it's not gonna change on a given MACHINE_ARCH. (if it does, well,
something _else_ is seriously wrong.)
* it's easier, nicer, faster code is produced if you do
masks/shifts/ands etc. with constants known at compile time than if
you do them all as needed at run-time with variables.
cgd
--
Chris Demetriou - cgd@netbsd.org - http://www.netbsd.org/People/Pages/cgd.html
Disclaimer: Not speaking for NetBSD, just expressing my own opinion.