http://www.opengroup.org/onlinepubs/009695399/functions/swab.html
the prototype for swab() should be in <unistd.h> and not in <string.h>.
Move it, and update to match SUS. Leave the prototype in string.h for
now, for backwards compat.
PR: 74751
Submitted by: Craig Rodrigues <rodrigc@crodrigues.org>
Discussed with: das
in the ANSI-C format.
- Change the code a bit to hopefully save some cycles.
I.e. (simplified) change
a = b + 1;
while (--b & 0x7)
/* ... */
to
a = b;
for (; b & 0x7; b--)
/* ... */
and
while (--a >= 0)
/* ... */
to
for (; a > 0; a--)
/* ... */
- Equip two function arguments of swab() with the 'restrict'
type qualifier in form of the '__restrict' macro. This is
specified by POSIX.1-2001.