Re: Endianness conversion functions
Christian Biere <[email protected]>
| Newsgroups | gmane.os.netbsd.devel.general |
|---|---|
| Message-ID | <20070120214000.GA6997@cyclonus> |
Krister Walfridsson wrote: > 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.) What about the prototype? Is a blatant use of __builtin_memcpy() ok? It seems GCC is not smart enough to replace a byte-copy loop with the equivalent __builtin_memcpy() on its own. -- Christian