8 #ifndef IMPALGEBRA_ENDIAN_H
9 #define IMPALGEBRA_ENDIAN_H
11 #include <IMP/algebra/algebra_config.h>
16 IMPALGEBRA_BEGIN_NAMESPACE
27 void IMPALGEBRAEXPORT
reversed_read(
void* dest,
size_t size,
size_t nitems,
28 std::ifstream& f,
bool reverse);
38 size_t nitems, std::ofstream& f,
39 bool reverse =
false);
41 #if !defined(SWIG) && !defined(IMP_DOXYGEN)
42 void IMPALGEBRAEXPORT byte_swap(
unsigned char* b,
int n);
48 byte_swap((
unsigned char*)&x,
sizeof(T));
58 IMPALGEBRA_END_NAMESPACE
bool get_is_big_endian()
Returns 1 if machine is big endian else 0.
Various general useful macros for IMP.
bool get_is_little_endian()
Returns 1 if machine is little endian else 0.
void reversed_read(void *dest, size_t size, size_t nitems, std::ifstream &f, bool reverse)
Reads from file in normal or reverse order.
void reversed_write(const void *src, size_t size, size_t nitems, std::ofstream &f, bool reverse=false)
Writes to a file in normal or reversed order.
void get_swapped_endian(T &x)
Conversion between little and big endian. Goes both ways.