5 /* Updated implementation based on byteswap.h from Miles Bader
6 * <miles@gnu.org>. This should be much faster on arches with machine
7 * specific, optimized definitions in include/bits/byteswap.h (i.e. on
8 * x86, use the bswap instruction on i486 and better boxes). For
9 * platforms that lack such support, this should be no slower than it
11 void swab (const void *source
, void *dest
, ssize_t count
)
13 const unsigned short *from
= source
, *from_end
= from
+ (count
>> 1);
15 unsigned short *to
= dest
;
17 while (from
< from_end
) {
18 /* Don't put '*from++'into the bswap_16() macros
19 * or mad things will happen on macro expansion */
21 *to
++ = bswap_16 (junk
);