Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 Jul 2004 18:30:35 +0200
From:      des@des.no (=?iso-8859-1?q?Dag-Erling_Sm=F8rgrav?=)
To:        David Malone <dwmalone@maths.tcd.ie>
Cc:        current@freebsd.org
Subject:   Re: recent libalias changes
Message-ID:  <xzpsmc6a02c.fsf@dwp.des.no>
In-Reply-To: <20040705161059.GA52584@walton.maths.tcd.ie> (David Malone's message of "Mon, 5 Jul 2004 17:10:59 %2B0100")
References:  <20040705133820.GA9159@stud.fit.vutbr.cz> <xzp1xjqbhee.fsf@dwp.des.no> <20040705161059.GA52584@walton.maths.tcd.ie>

next in thread | previous in thread | raw e-mail | index | archive | help
David Malone <dwmalone@maths.tcd.ie> writes:
> With Divacky's help we localised his problem to alias.c. The twowords
> function breaks the strick aliasing rule, try replacing it with:
>
> static __inline int
> twowords(void *p)
> {
>         unsigned char *c =3D p;
>
>         return ((((unsigned short)c[1] + (unsigned short)c[3])<<8) + c[0]=
 + c[2];
> }

oh no you don't - this is not endian-clean.

DES
--=20
Dag-Erling Sm=F8rgrav - des@des.no



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