CWB
Functions
endian.h File Reference

globals.h checks whether endianness is well-defined. More...

#include <netinet/in.h>

Functions

int cl_bswap32 (int x)
 Swaps the byte order of a integer. More...
 

Detailed Description

globals.h checks whether endianness is well-defined.

The CWB uses network byte order (i.e. Most Significant Byte First) for 32-bit integers stored in its platform-independent disk files.

Conversion to and from processor-native byte order is handled by the BSD functions/macros htonl() and ntohl(), which must be available in the system library.

Function Documentation

int cl_bswap32 ( int  x)

Swaps the byte order of a integer.

This function is a portable bswap implementation allowing explicit conversion to little-endian format (by a combination of cl_bswap32() and htonl())

Note that this function will work correctly with 32bit and larger int data types.

Parameters
xThe integer whose bytes are to be reordered.
Returns
The reordered integer.

Referenced by process_fd().