Subject: Re: Converting to little endian
To: None <tech-kern@netbsd.org>
From: Alan Barrett <apb@iafrica.com>
List: tech-kern
Date: 12/31/1998 12:30:29
> : But bswap does something on all platforms.  I want a function that
> : is a no-op on little endian and does a bswap on big endian.  It
> : would be nice to have a standard name for it.
>
> Then propose something ... it need only then be #defined in terms of a
> no-op or a bswap*() call. :)

We have ntoh{l,s} and hton{l,s} for converting between network byte
order ("n", big-endian) and native host hyte order ("h").  Now we just
need footoh{l,s} and htofoo{l,s} for converting between little-endian
and host byte order.

But what should "foo" be?  I suggest using "v", following the precedent
set by Perl's "pack" and "unpack" functions.  So we get vtoh{l,s} and
htov{l,s} as functions to convert between native host byte order ("h")
and little-endian byte order ("v").

--apb (Alan Barrett)