bytes2func.h

Description

bytes2func.h is the C header file in code/sidescan/xtf/ that declares the endian-aware byte-unpacking functions implemented in bytes2func.c and the global SWAP flag used across the XTF sidescan conversion suite (xtf2glo).

Declarations

#define TRUE 1
#define FALSE 0

short  bytes2short(unsigned char *bytes);
int    bytes2int(unsigned char *bytes);
float  bytes2float(unsigned char *bytes);
double bytes2double(unsigned char *bytes);

char SWAP; /* Set to TRUE on big-endian hosts, FALSE on little-endian PCs */

Purpose

Triton .xtf files are recorded in little-endian (80x86) byte order with unaligned fields. Including bytes2func.h allows chxtfhdr.c and xtf2glo.c to safely decode 16-bit integers, 32-bit integers, 32-bit IEEE floats, and 64-bit IEEE doubles from raw unsigned char buffers regardless of host CPU alignment or endianness.