|
My Project
|
#include <stdio.h>#include <stdlib.h>#include <string.h>#include <math.h>#include "include/swap.h"
Functions | |
| int | little_endian () |
| void | swap (void *from, void *to, int size) |
| void | swabip (void *buf, int size) |
| void | swawbip (void *buf, int size) |
| void | swawip (void *buf, int size) |
| void | printf32bits (void *buf) |
| int little_endian | ( | ) |
Check whether current platform uses little endian byte order. See H&S Sec. 6.1.2 pp. 163-4.
| void printf32bits | ( | void * | buf | ) |
Printfs as bit string the 32-bit variable pointed to by buf. Far from being optimized, thus only for testing and development purposes.
| buf | Pointer to memory |
| void swabip | ( | void * | buf, |
| int | size | ||
| ) |
In-place swab, replaces the non-ANSI function swab(), which may not work if data is overlapping.
| buf | Pointer to memory |
| size | Size of buf in bytes |
| void swap | ( | void * | from, |
| void * | to, | ||
| int | size | ||
| ) |
Swaps the specified short int, int, long int, float, or double from little endian to big endian or vice versa. Arguments are allowed to overlap.
| from | Pointer to a short int, int, long int, float, or double variable |
| to | Pointer to a short int, int, long int, float, or double variable |
| size | Size of from and to (byte nr) must be 1, 2, 4 or 8. |
References swap().
Referenced by intExpand(), and swap().

| void swawbip | ( | void * | buf, |
| int | size | ||
| ) |
In-place swab and swaw, switches words and bytes from an array of 4-byte ints or floats.
| buf | Pointer to memory |
| size | Size of buf in bytes |
| void swawip | ( | void * | buf, |
| int | size | ||
| ) |
In-place swaw, switches words (but not bytes) from an array of 4-byte ints or floats.
| buf | Pointer to memory |
| size | Size of buf in bytes |