/*Swizit: This routine swizzles the byte order in 'length' variables of size 'elsize' pointed to by 'data'. Written by Sandor L. Barna, December 1993. */ #include <stdio.h> #include <string.h> void swizit(char *data,int elsize,int length) { int i; int j; char c[20]; /*Can handle elsize up to 20*/ for (i=0;i<length;i++) { for (j=0;j<elsize;j++) c[j]=data[i*elsize+j]; for (j=0;j<elsize;j++) data[i*elsize+j]=c[elsize-1-j]; } return; }