1 #ifndef __stir_ByteOrder_H__ 2 #define __stir_ByteOrder_H__ 78 inline static void revert(
unsigned char* ptr)
80 std::swap(ptr[0], ptr[size - 1]);
81 revert_region<size - 2>::revert(ptr + 1);
86 class revert_region<1>
89 inline static void revert(
unsigned char* ptr) {}
93 class revert_region<0>
96 inline static void revert(
unsigned char* ptr) {}
114 inline static Order get_native_order();
121 template <
class NUMBER>
124 revert_region<sizeof(NUMBER)>::revert(
reinterpret_cast<unsigned char*
>(&value));
133 inline bool operator==(
const ByteOrder order2)
const;
134 inline bool operator!=(
const ByteOrder order2)
const;
137 inline bool is_native_order()
const;
144 template <
class NUMBER>
147 if (!is_native_order())
153 static const Order native_order;
static void swap_order(NUMBER &value)
swap the byteorder of the argument
Definition: ByteOrder.h:122
Order
enum for specifying the byte-order
Definition: ByteOrder.h:103
Definition: ByteOrder.h:106
This class provides member functions to find out what byte-order your machine is and to swap numbers...
Definition: ByteOrder.h:99
void swap_if_necessary(NUMBER &a) const
this swaps only when the order != native order
Definition: ByteOrder.h:145
This file declares the stir::ByteOrder class.
Definition: ByteOrder.h:105
basic configuration include file
Definition: ByteOrder.h:107