/****************************************************************************** $Id: swap.c,v 1.1 2013/02/14 16:58:03 pascal Exp $ *****************************************************************************/ #include #include #include "config.h" #include "EndianSwap/swap.h" /****************************************************************************** ES_swap ############### swap data between big-endian and little-endian representation. IN: size_t size: size of the value type. INOUT: void * val: pointer to the value to swap between big-endian and little-endian. RETURN: short * : pointer to val *****************************************************************************/ void * ES_swap(void * val, const size_t size) { int i; /* iterator */ unsigned char * pc1; char * tmp_val; pc1 = (unsigned char *)val; tmp_val = malloc(size * sizeof(char)); pc1 = (unsigned char *)val; for(i=0; i