1 #ifndef __BYTE_SWAPPING_H__ 2 #define __BYTE_SWAPPING_H__ 43 static void swap(T& toSwap);
46 static void swapArray(T* toSwap,
const uint64_t& count);
48 inline static bool isBigEndian()
51 return (((
char*)&test)[0] == 0);
57 void ByteSwapping::swap(T& toSwap)
59 if (
sizeof(T) == 1)
return;
61 char* from = (
char*)&temp;
62 char* to = (
char*)&toSwap;
63 for (
int i = 0; i < (int)
sizeof(T); ++i)
65 to[i] = from[
sizeof(T) - i - 1];
70 void ByteSwapping::swapArray(T* toSwap,
const uint64_t& count)
72 if (
sizeof(T) == 1)
return;
73 for (uint64_t i = 0; i < count; ++i)
81 #endif // __BYTE_SWAPPING_H__ namespace for all CiftiLib functionality
Definition: CiftiBrainModelsMap.h:41
Definition: ByteSwapping.h:40