Subject: Re: Endianness conversion functions
To: None <tech-misc@NetBSD.org>
From: Christian Biere <christianbiere@gmx.de>
List: tech-misc
Date: 01/19/2007 00:50:41
Christian Biere wrote:
> 	uint32_t x;
> 	memcpy(&x, buf, 4);
> 	return le32toh(x);
 
> Even with -O0 there's no call to memcpy() only to this function. With -O1 the
> code is always inlined even if inline isn't specified.

Actually if both __inline (or inline) and __attribute__((__always_inline__))
are used, then function is inlined at -O0 too. The call to bswap however isn't.
So if -O0 is a concern, there should be bswap_inline variants which should be
used here.

-- 
Christian