00001 #include "L3swap.h"
00002
00003 #include <netinet/in.h>
00004
00005 float fswap(float swapped)
00006 {
00007 unsigned int* uintptr = (unsigned int*) &swapped;
00008 unsigned int uintvar = ntohl(*uintptr);
00009 float* floatvar = (float*)&uintvar;
00010 return *floatvar;
00011 }
00012
00013 UINT32 swap32(UINT32 in)
00014 {
00015 register UINT32 x ;
00016 x = in ;
00017
00018 return (x&0xff000000) >> 24 | \
00019 (x&0x00ff0000) >> 8 | \
00020 (x&0x0000ff00) << 8 | \
00021 (x&0x000000ff) << 24;
00022 }
00023
00024
00025 UINT16 swap16(UINT16 in)
00026 {
00027 register UINT16 x ;
00028
00029 x = in ;
00030
00031 return (x&0xFF00) >> 8 | (x&0xFF) << 8 ;
00032 }
00033
00034 bool checkByteOrder(UINT32 byte_order)
00035 {
00036 return ( byte_order == DAQ_RAW_FORMAT_ORDER );
00037 }