00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef __SIILUTIL_H__
00028 #define __SIILUTIL_H__
00029
00030
00031
00032
00033 #include <SIBCUtil.h>
00034
00035
00036
00037
00038
00039 #ifdef _WIN32
00040
00041 #ifndef LITTLE_ENDIAN
00042 #define SWAP_SHORT(n) (((((SI_UShort)(n))&0xff00)>>8)|((((SI_UShort)(n))&0x00ff)<<8))
00043 #define SWAP_LONG(n) ((((SI_ULong)(n))>>24)|(((SI_ULong)(n))>>8&0xff00)|(((SI_ULong)(n))<<8&0xff0000)|(((SI_ULong)(n))<<24))
00044 #define SWAP_FLOAT(n) SI_ImageSwapFloat(n)
00045 #define INV_SWAP_SHORT(n) (n)
00046 #define INV_SWAP_LONG(n) (n)
00047 #define INV_SWAP_FLOAT(n) (n)
00048 #else
00049 #define SWAP_SHORT(n) (n)
00050 #define SWAP_LONG(n) (n)
00051 #define SWAP_FLOAT(n) (n)
00052 #define INV_SWAP_SHORT(n) (((((SI_UShort)(n))&0xff00)>>8)|((((SI_UShort)(n))&0x00ff)<<8))
00053 #define INV_SWAP_LONG(n) ((((SI_ULong)(n))>>24)|(((SI_ULong)(n))>>8&0xff00)|(((SI_ULong)(n))<<8&0xff0000)|(((SI_ULong)(n))<<24))
00054 #define INV_SWAP_FLOAT(n) SI_ImageSwapFloat(n)
00055 #endif
00056
00057 #else
00058
00059 #ifndef BYTE_ORDER
00060
00061 #ifndef LITTLE_ENDIAN
00062 #define SWAP_SHORT(n) (n)
00063 #define SWAP_LONG(n) (n)
00064 #define SWAP_FLOAT(n) (n)
00065 #define INV_SWAP_SHORT(n) (((((SI_UShort)(n))&0xff00)>>8)|((((SI_UShort)(n))&0x00ff)<<8))
00066 #define INV_SWAP_LONG(n) ((((SI_ULong)(n))>>24)|(((SI_ULong)(n))>>8&0xff00)|(((SI_ULong)(n))<<8&0xff0000)|(((SI_ULong)(n))<<24))
00067 #define INV_SWAP_FLOAT(n) SI_ImageSwapFloat(n)
00068 #else
00069 #define SWAP_SHORT(n) (((((SI_UShort)(n))&0xff00)>>8)|((((SI_UShort)(n))&0x00ff)<<8))
00070 #define SWAP_LONG(n) ((((SI_ULong)(n))>>24)|(((SI_ULong)(n))>>8&0xff00)|(((SI_ULong)(n))<<8&0xff0000)|(((SI_ULong)(n))<<24))
00071 #define SWAP_FLOAT(n) SI_ImageSwapFloat(n)
00072 #define INV_SWAP_SHORT(n) (n)
00073 #define INV_SWAP_LONG(n) (n)
00074 #define INV_SWAP_FLOAT(n) (n)
00075 #endif
00076
00077 #else
00078
00079 #if ( BYTE_ORDER == LITTLE_ENDIAN )
00080 #define SWAP_SHORT(n) (n)
00081 #define SWAP_LONG(n) (n)
00082 #define SWAP_FLOAT(n) (n)
00083 #define INV_SWAP_SHORT(n) (((((SI_UShort)(n))&0xff00)>>8)|((((SI_UShort)(n))&0x00ff)<<8))
00084 #define INV_SWAP_LONG(n) ((((SI_ULong)(n))>>24)|(((SI_ULong)(n))>>8&0xff00)|(((SI_ULong)(n))<<8&0xff0000)|(((SI_ULong)(n))<<24))
00085 #define INV_SWAP_FLOAT(n) SI_ImageSwapFloat(n)
00086 #else
00087 #define SWAP_SHORT(n) (((((SI_UShort)(n))&0xff00)>>8)|((((SI_UShort)(n))&0x00ff)<<8))
00088 #define SWAP_LONG(n) ((((SI_ULong)(n))>>24)|(((SI_ULong)(n))>>8&0xff00)|(((SI_ULong)(n))<<8&0xff0000)|(((SI_ULong)(n))<<24))
00089 #define SWAP_FLOAT(n) SI_ImageSwapFloat(n)
00090 #define INV_SWAP_SHORT(n) (n)
00091 #define INV_SWAP_LONG(n) (n)
00092 #define INV_SWAP_FLOAT(n) (n)
00093 #endif
00094
00095 #endif
00096
00097 #endif
00098
00099
00100
00101
00102
00107 extern SI_Float SI_ImageSwapFloat(SI_Float value);
00108
00109
00110 #endif // __SIILUTIL_H__