56 #ifndef OPENMESH_SR_RBO_HH
57 #define OPENMESH_SR_RBO_HH
64 #if defined(OM_CC_MIPS)
73 #include <OpenMesh/Core/IO/SR_types.hh>
74 #include <OpenMesh/Core/Utils/GenProg.hh>
96 template <
size_t N >
inline
106 _val[0] ^= _val[1]; _val[1] ^= _val[0]; _val[0] ^= _val[1];
113 _val[0] ^= _val[3]; _val[3] ^= _val[0]; _val[0] ^= _val[3];
114 _val[1] ^= _val[2]; _val[2] ^= _val[1]; _val[1] ^= _val[2];
121 _val[0] ^= _val[7]; _val[7] ^= _val[0]; _val[0] ^= _val[7];
122 _val[1] ^= _val[6]; _val[6] ^= _val[1]; _val[1] ^= _val[6];
123 _val[2] ^= _val[5]; _val[5] ^= _val[2]; _val[2] ^= _val[5];
124 _val[3] ^= _val[4]; _val[4] ^= _val[3]; _val[3] ^= _val[4];
131 _val[0] ^= _val[11]; _val[11] ^= _val[0]; _val[0] ^= _val[11];
132 _val[1] ^= _val[10]; _val[10] ^= _val[1]; _val[1] ^= _val[10];
133 _val[2] ^= _val[ 9]; _val[ 9] ^= _val[2]; _val[2] ^= _val[ 9];
134 _val[3] ^= _val[ 8]; _val[ 8] ^= _val[3]; _val[3] ^= _val[ 8];
135 _val[4] ^= _val[ 7]; _val[ 7] ^= _val[4]; _val[4] ^= _val[ 7];
136 _val[5] ^= _val[ 6]; _val[ 6] ^= _val[5]; _val[5] ^= _val[ 6];
171 omerr() <<
"Not defined for type " <<
typeid(T).name() << std::endl;
178 #if defined(OM_CC_GCC)
184 #define REVERSE_FUNDAMENTAL_TYPE( T ) \
185 template <> inline T& reverse_byte_order( T& _t ) {\
186 _reverse_byte_order_N<sizeof(T)>( reinterpret_cast<uint8_t*>(&_t) ); \
193 REVERSE_FUNDAMENTAL_TYPE(
int16_t)
198 REVERSE_FUNDAMENTAL_TYPE(
unsigned long)
199 REVERSE_FUNDAMENTAL_TYPE(
int32_t)
201 REVERSE_FUNDAMENTAL_TYPE(
int64_t)
203 REVERSE_FUNDAMENTAL_TYPE(
float)
204 REVERSE_FUNDAMENTAL_TYPE(
double)
205 REVERSE_FUNDAMENTAL_TYPE(
long double)
207 #undef REVERSE_FUNDAMENTAL_TYPE
211 #define REVERSE_VECTORT_TYPE( T ) \
212 template <> inline T& reverse_byte_order(T& _v) {\
213 for (size_t i; i< T::size_; ++i) \
214 _reverse_byte_order_N< sizeof(T::value_type) >( reinterpret_cast<uint8_t*>(&_v[i])); \
218 #define REVERSE_VECTORT_TYPES( N ) \
219 REVERSE_VECTORT_TYPE( Vec##N##c ) \
220 REVERSE_VECTORT_TYPE( Vec##N##uc ) \
221 REVERSE_VECTORT_TYPE( Vec##N##s ) \
222 REVERSE_VECTORT_TYPE( Vec##N##us ) \
223 REVERSE_VECTORT_TYPE( Vec##N##i ) \
224 REVERSE_VECTORT_TYPE( Vec##N##ui ) \
225 REVERSE_VECTORT_TYPE( Vec##N##f ) \
226 REVERSE_VECTORT_TYPE( Vec##N##d ) \
228 REVERSE_VECTORT_TYPES(1)
229 REVERSE_VECTORT_TYPES(2)
230 REVERSE_VECTORT_TYPES(3)
231 REVERSE_VECTORT_TYPES(4)
232 REVERSE_VECTORT_TYPES(6)
234 #undef REVERSE_VECTORT_TYPES
235 #undef REVERSE_VECTORT_TYPE
239 template <
typename T>
inline
242 compile_timer_error__const_means_const(a);
254 #endif // OPENMESH_SR_RBO_HH defined
void _reverse_byte_order_N< 1 >(uint8_t *)
void _reverse_byte_order_N(uint8_t *_val)
void compile_time_error__no_fundamental_type()
void _reverse_byte_order_N< 12 >(uint8_t *_val)
void _reverse_byte_order_N< 2 >(uint8_t *_val)
void _reverse_byte_order_N< 4 >(uint8_t *_val)
void _reverse_byte_order_N< 16 >(uint8_t *_val)
void _reverse_byte_order_N< 8 >(uint8_t *_val)
unsigned long long uint64_t
T * reverse_byte_order(T *t)