SWAB(3) Library Functions Manual SWAB(3)

swabswap adjacent bytes

Standard C Library (libc, -lc)

#include <unistd.h>

void
swab(const void *restrict src, void *restrict dest, ssize_t nbytes);

The function () copies nbytes bytes from the location referenced by src to the location referenced by dest, swapping adjacent bytes.

The argument nbytes should be an even number. If nbytes is odd, () copies and exchanges nbytes -1 bytes and the disposition of the last byte is unspecified. If copying takes place between objects that overlap, the behavior is undefined. If nbytes is negative, swab() does nothing.

bzero(3), memset(3), compat(5)

A swab() function appeared in Version 7 AT&T UNIX.

February 24, 2010 Mac OS X 12