--- sacswap.c.old 2006-03-27 15:44:54.000000000 -0500 +++ sacswap.c 2008-08-31 14:15:54.000000000 -0400 @@ -47,7 +47,6 @@ #define HEADER_SIZE (NFLOATS * FLOAT_SIZE) + (NINTS * INT_SIZE) + (NCHARS * CHAR_SIZE) int file_size(char *file); -float float_swap(char cbuf[]); long long_swap(char cbuf[]); long long_join(char cbuf[]); @@ -63,6 +62,7 @@ FILE *fp; char swap[2048]; int size; + long tmp; /* Check usage */ if (ac < 2) { @@ -95,7 +95,8 @@ } /* Swap the floats */ for(j = 0; j< NFLOATS; j++) { - sacfloat[j] = float_swap(cbuf + FLOAT_SIZE * j); + tmp = long_swap(cbuf + FLOAT_SIZE * j); + sacfloat[j] = *(float *)(&tmp); } /* ints */ @@ -149,7 +150,8 @@ fprintf(stderr, "%s: exiting\n", PROGRAM); exit(-1); } - data[j] = (float) float_swap(cbuf); + tmp = long_swap(cbuf); + data[j] = *(float *)(&tmp); } fclose(fp); @@ -206,20 +208,6 @@ return(l_union.lval); } -float -float_swap(char cbuf[]) { - union { - char cval[4]; - float fval; - } f_union; - - f_union.cval[3] = cbuf[0]; - f_union.cval[2] = cbuf[1]; - f_union.cval[1] = cbuf[2]; - f_union.cval[0] = cbuf[3]; - return(f_union.fval); -} - long long_join(char cbuf[]) { union {