Subject: Re: Endianness conversion functions
To: Christian Biere <christianbiere@gmx.de>
From: Krister Walfridsson <cato@df.lth.se>
List: tech-misc
Date: 01/18/2007 22:41:11
On Thu, 18 Jan 2007, Christian Biere wrote:
> are there any objections against the patch below? These could then
> completely replace the almost identical code in sys/fs/cd9660/iso.h
> as well as sys/fs/msdosfs/bpb.h and -DUNALIGNED_ACCESS could be removed
> from the relevant Makefiles.
This breaks the C aliasing rules [*], so I would prefer to instead
change sys/fs/cd9660/iso.h and sys/fs/msdosfs/bpb.h to use a correct
implementation (using e.g. memcpy, which for sufficiently new gcc
should generate as efficient code but without the potential lossage
arising from aliasing issues.) Or use the current sys/sys/endian.h
implementation. Does it really give a measurable slow down in real
life?
/Krister
[*] That statement is a bit oversimplified. See e.g. my old mail
http://mail-index.netbsd.org/tech-kern/2003/08/11/0001.html
for a more detailed discussion.