00001 00016 /* Auto-generated header */ 00017 #include "SickConfig.hh" 00018 00023 #define REVERSE_BYTE_ORDER_16( y ) ( ( ( y & 0x00FF ) << 8 ) | ( ( y & 0xFF00 ) >> 8 ) ) 00024 00029 #define REVERSE_BYTE_ORDER_32( y ) ( ( ( y & 0x000000FF ) << 24 ) | ( ( y & 0x0000FF00 ) << 8 ) | ( ( y & 0x00FF0000 ) >> 8 ) | ( ( y & 0xFF000000 ) >> 24 ) ) 00030 00031 /* Associate the namespace */ 00032 namespace SickToolbox { 00033 00034 #ifndef WORDS_BIGENDIAN 00035 00036 /* NOTE: The following functions are necessary since the Sick LD doesn't adopt the 00037 * convention of converting from network byte order. 00038 */ 00039 00045 inline uint16_t host_to_sick_ld_byte_order( uint16_t value ) { 00046 return REVERSE_BYTE_ORDER_16(value); 00047 } 00048 00054 inline uint32_t host_to_sick_ld_byte_order( uint32_t value ) { 00055 return REVERSE_BYTE_ORDER_32(value); 00056 } 00057 00063 inline uint16_t sick_ld_to_host_byte_order( uint16_t value ) { 00064 return REVERSE_BYTE_ORDER_16(value); 00065 } 00066 00072 inline uint32_t sick_ld_to_host_byte_order( uint32_t value ) { 00073 return REVERSE_BYTE_ORDER_32(value); 00074 } 00075 00076 #else // The host has a big-endian architecture 00077 00083 inline uint16_t host_to_sick_ld_byte_order( uint16_t value ) { 00084 return value; 00085 } 00086 00092 inline uint32_t host_to_sick_ld_byte_order( uint32_t value ) { 00093 return value; 00094 } 00095 00101 inline uint16_t sick_ld_to_host_byte_order( uint16_t value ) { 00102 return value; 00103 } 00104 00110 inline uint32_t sick_ld_to_host_byte_order( uint32_t value ) { 00111 return value; 00112 } 00113 00114 #endif /* _LITTLE_ENDIAN_HOST */ 00115 00116 /* 00117 * NOTE: Other utility functions can be defined here 00118 */ 00119 00120 } //namespace SickToolbox