00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef INCLUDED_USRP_BYTESEX_H
00023 #define INCLUDED_USRP_BYTESEX_H
00024
00033 #ifdef HAVE_BYTESWAP_H
00034 #include <byteswap.h>
00035 #else
00036 static inline unsigned short int
00037 bswap_16 (unsigned short int x)
00038 {
00039 return ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8));
00040 }
00041 #endif
00042
00043
00044 #ifdef WORDS_BIGENDIAN
00045
00046 static inline short int
00047 host_to_usrp_short (short int x)
00048 {
00049 return bswap_16 (x);
00050 }
00051
00052 static inline short int
00053 usrp_to_host_short (short int x)
00054 {
00055 return bswap_16 (x);
00056 }
00057
00058 #else
00059
00060 static inline short int
00061 host_to_usrp_short (short int x)
00062 {
00063 return x;
00064 }
00065
00066 static inline short int
00067 usrp_to_host_short (unsigned short int x)
00068 {
00069 return x;
00070 }
00071
00072 #endif
00073
00074 #endif