Main Page | Data Structures | Directories | File List | Data Fields | Globals | Related Pages

swap.c File Reference

#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)

Function Documentation

int little_endian  ) 
 

Check whether current platform uses little endian byte order. See H&S Sec. 6.1.2 pp. 163-4.

Returns:
Returns 1, if current platform is little endian, and 0 if not.

void printf32bits void *  buf  ) 
 

void swabip void *  buf,
int  size
 

In-place swab, replaces the non-ANSI function swab(), which may not work if data is overlapping.

Parameters:
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.

Parameters:
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.

void swawbip void *  buf,
int  size
 

In-place swab and swaw, switches words and bytes from an array of 4-byte ints or floats.

Parameters:
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.

Parameters:
buf  Pointer to memory
size  Size of buf in bytes


Generated on Fri Jan 21 16:17:42 2005 for libPET by  doxygen 1.4.1