Subject: Re: CVS commit: src/sys/lib/libsa
To: None <source-changes@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: source-changes
Date: 12/03/2006 21:44:31
David Laight wrote:
> I've found out which change make the code bloat...
> http://cvsweb.netbsd.org/bsdweb.cgi/src/sys/fs/msdosfs/bpb.h.diff?r1=1.4&r2=1.5&f=h
> 
> It seems gcc generates better code for:
> 	a[0] + (a[1] << 8) + (a[2] << 16) + (a[3] << 24)
> than for:
> 	a[0] | (a[1] << 8) | (a[2] << 16) | (a[3] << 24)
> 
> However the code really needs:
> 	#if (BYTE_ORDER == LITTLE_ENDIAN) && defined(UNALIGNED_ACCESS)
> to be true...

Why can't GCC figure out that much itself? Also why does code like this exist in
so many places? These should be static inline functions, not macros. I suggested
peek/poke functions before.

-- 
Christian