recent libalias changes

Dag-Erling Smørgrav des at des.no
Mon Jul 5 09:30:44 PDT 2004


David Malone <dwmalone at 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 = 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
-- 
Dag-Erling Smørgrav - des at des.no


More information about the freebsd-current mailing list