Re: recent libalias changes

From: Dag-Erling Smørgrav <des_at_des.no>
Date: Mon, 05 Jul 2004 18:30:35 +0200
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
Received on Mon Jul 05 2004 - 14:30:44 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:38:00 UTC