JWS C Library
C language utility library
bits.h File Reference

Manipulate data types on the bit (or byte) level. More...

#include <jwsc/config.h>
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
Include dependency graph for bits.h:

Go to the source code of this file.

Functions

bswap

Swaps the byte ordering between big and little endian.

void bswap_u16 (uint16_t *x)
 Swaps the 16-bit byte ordering between big and little endian.
void bswap_u32 (uint32_t *x)
 Swaps the 32-bit byte ordering between big and little endian.
void bswap_u64 (uint64_t *x)
 Swaps the 64-bit byte ordering between big and little endian.

Detailed Description

Manipulate data types on the bit (or byte) level.

Author:
Joseph Schlecht
License:
Creative Commons BY-NC-SA 3.0

Definition in file bits.h.


Function Documentation

void bswap_u16 ( uint16_t *  x)

Swaps the 16-bit byte ordering between big and little endian.

Byte swaps a big-endian value to little-endian and vise versa. the parameter is passed by reference.

Parameters:
xValue to swap the bytes of.

Definition at line 68 of file bits.c.

void bswap_u32 ( uint32_t *  x)

Swaps the 32-bit byte ordering between big and little endian.

Byte swaps a big-endian value to little-endian and vise versa. the parameter is passed by reference.

Parameters:
xValue to swap the bytes of.

Definition at line 81 of file bits.c.

void bswap_u64 ( uint64_t *  x)

Swaps the 64-bit byte ordering between big and little endian.

Byte swaps a big-endian value to little-endian and vise versa. the parameter is passed by reference.

Parameters:
xValue to swap the bytes of.

Definition at line 96 of file bits.c.