Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 15 Dec 1998 00:47:30 +0100
From:      Eivind Eklund <eivind@yes.no>
To:        Matt Dillon <dillon@FreeBSD.ORG>, cvs-committers@FreeBSD.ORG, cvs-all@FreeBSD.ORG
Subject:   Re: cvs commit: src/sys/sys sem.h
Message-ID:  <19981215004730.U5444@follo.net>
In-Reply-To: <199812142134.NAA18826@freefall.freebsd.org>; from Matt Dillon on Mon, Dec 14, 1998 at 01:34:56PM -0800
References:  <199812142134.NAA18826@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, Dec 14, 1998 at 01:34:56PM -0800, Matt Dillon wrote:
> dillon      1998/12/14 13:34:56 PST
> 
>   Modified files:
>     sys/sys              sem.h 
>   Log:
>       Remove hardwired alignment, align to sizeof(long) which should be more
>       portable (though the hardwired alignment of 16 would also have worked just
>       fine and perhaps even resulted in better L1 cache operation).

This is a bad alignment.  The correct restriction is something like
struct aligner {
	char dummy;
	union {
		float f;
		double d;
		long int l;
		void *p;
		struct something *pstruct;
		void (*func)();
	} offsetter;
};
Align at offsetof(struct aligner, offsetter);

16 is better than sizeof(long), I think.

(I hope I got the set of types above correct - I think the pointer
set is right, at least).

Eivind.

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19981215004730.U5444>