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