Subject: bswap* move from libutil to libc ...
To: None <tech-userlevel@netbsd.org>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-userlevel
Date: 12/22/1998 14:41:30
Hi,
I've put in ftp://ftp.netbsd.org/pub/incoming/bouyer the diffs for a move
of the bswap functions from libutil to libc.
While doing that, I've gone a little further:
- the bswap functions are now declared in machine/bswap.h, as explained
  in my previous mail. On little-endian machine with inline versions of
  ntohl and ntohs, the common part is in machine/byte_swap.h.
- on little-endian machines with assembly versions of ntohl and ntohs,
  I moved this code to byte_swap2.S and byte_swap4.S, and I use alternate
  entries for ntoh*/hton*, so that the object code is shared.
  The bswap16() and bswap32() functions are renamed to __bswap16() and
  __bswap32() to avoid namespace pollution (a program pulling up
  ntohs also would ends up with bswap16() being defined, which could collide
  with his own declaration).
- The same thing has been done in libkern, but without the symbol renaming
  stuff.

I'm not really happy with userland code needing to include machine/bswap.h
to get the bswap*() functions, but I don't know in which MI header I could
pull it up. As machine/bswap.h needs sys/types.h which pull up
machine/endian.h, maybe taking out the declarations from endian.h was not a
good idea ...

comments ?

--
Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
--