[uClibc]Re: swab() in swab.c attached
Miles Bader
miles at lsi.nec.co.jp
Thu Apr 4 01:08:07 UTC 2002
On my platform, this function is faster if you use the `bswap_16'
function (from <byteswap.h>); I don't if this is true for other
platforms, though.
Here's the version I tested:
#include <unistd.h>
#include <sys/types.h>
#include <byteswap.h>
void swab (const void *source, void *dest, ssize_t count)
{
const unsigned short *from = source, *from_end = from + (count >> 1);
unsigned short *to = dest;
while (from < from_end)
*to++ = bswap_16 (*from++);
}
Cheers,
-Miles
--
Occam's razor split hairs so well, I bought the whole argument!
More information about the uClibc
mailing list