Subject: bswap{16,32,64} declarations
To: None <tech-userlevel@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-userlevel
Date: 12/17/1998 14:52:46
Hi,
for now the bswap{16,32,64} functions are declared in machine/endian.h,
along with inline assembly for those archs which have one.
I originally put them here because on little endian archs, the inline
macros can be shared with ntoh*.
Now, because of namespace polution, these functions should either be
moved to another header, or protected by a #ifdef something (I'm going to
move these to libc, so I want to do all at once).
If they are moved to another header, it's likely to be <machine/bswap.h>
because it contains machine-dependant bits (the inline macros).
The common part between the ntoh* and bswap* macros needs to go
in a third header.
For example, for the i386, there would be a machine/byte_swap.h with
the inline code, used by both machine/bswap.h and machine/endian.h.
The second solution (leave all in machine/bswap.h with appropriate #ifdef)
avoid the headers proliferation, but one could argue that byte-swapping
functions have nothing to do with the endian of a given port.
I will not be able to read e-mail tomorow, and I'd like to start working
on this saturday. So please make comments about this, and I'll try to
deduce the rigth decision saturday (I'd like to start working on this
saturday, to have working patches monday - but the commit will not happen
before january anyway).
I'd personally prefer to not have the bswap* functions in endian.h, but this
is not a strong sentiment ...
--
Manuel Bouyer, LIP6, Universite Paris VI. Manuel.Bouyer@lip6.fr
--