Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 void swaplong();
00014 void swapshort();
00015
00016 #if ( SGI || sgi || LINUX || linux )
00017 void swapvms();
00018
00019
00020
00021
00022 void
00023 swapvms( data, n )
00024 float *data;
00025 int n;
00026 {
00027 int i;
00028 float d;
00029
00030 for (i=0; i<n; i++ ) {
00031 swab( &data[i], &data[i], 4 );
00032 #if ( SGI || sgi || LINUX || linux )
00033 data[i]/=4.;
00034 #else
00035 sprintf( str, "%1.6f",data[i] );
00036 d = atof( str );
00037 data[i]=d/4.;
00038 #endif
00039 }
00040 }
00041 #endif
00042
00043 #ifdef SWAP
00044
00045
00046
00047 void
00048 swaplong(data, nbytes)
00049 register char *data;
00050 int nbytes;
00051 {
00052 register int i, t1, t2, t3, t4;
00053
00054 for(i=nbytes/4;i--;) {
00055 t1 = data[i*4+3];
00056 t2 = data[i*4+2];
00057 t3 = data[i*4+1];
00058 t4 = data[i*4+0];
00059 data[i*4+0] = t1;
00060 data[i*4+1] = t2;
00061 data[i*4+2] = t3;
00062 data[i*4+3] = t4;
00063 }
00064 }
00065
00066
00067
00068
00069 void
00070 swapshort(data, n)
00071 register unsigned short *data;
00072 int n;
00073 {
00074 register int i;
00075 register unsigned short t;
00076
00077 for(i=(n>>1)+1;--i;) {
00078
00079 t = (((*data) << 8) | ((*data) >> 8));
00080 *data++ = t;
00081 }
00082 }
00083 #endif