[Previous] [Contents] [Next]

swab()

Endian-swap nbytes bytes

Synopsis:

#include <unistd.h>

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

Library:

libc

Description:

The swab() function copies nbytes bytes, pointed to by src, to the object pointed to by dest, exchanging adjacent bytes. The nbytes argument should be even.

If nbytes is: Then:
odd nbytes-1 bytes are copied and exchanged. The disposition of the last byte is unspecified.
negative swab() does nothing.

If copying takes place between objects that overlap, the behaviour is undefined.

Classification:

Standard Unix

Safety:
Cancellation point No
Interrupt handler Yes
Signal handler Yes
Thread Yes

See also:

ENDIAN_SWAP32(), ENDIAN_SWAP64()


[Previous] [Contents] [Next]