Loading isis/src/base/objs/EndianSwapper/EndianSwapper.cpp +22 −1 Original line number Diff line number Diff line Loading @@ -138,6 +138,28 @@ namespace Isis { return result; } /** * Swaps a 32bit unsigned integer. * * @param buf Input uint32 integer value to swap. */ uint32_t EndianSwapper::Uint32_t(void *buf) { uint32_t result = *(uint32_t *)buf; if(p_needSwap) { char *ptr = (char *)buf + (sizeof(uint32_t) - 1) * p_needSwap; for(unsigned int i = 0; i < sizeof(uint32_t); i++) { p_swapper.p_char[i] = *ptr; ptr += p_swapDirection; } result = p_swapper.p_uint32; } return result; } /** * Swaps an 8 byte integer value. * Loading Loading @@ -203,4 +225,3 @@ namespace Isis { return result; } } isis/src/base/objs/EndianSwapper/EndianSwapper.h +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ namespace Isis { * not added because it is 4 bytes on 32-bit linux and 8 bytes on * 64-bit linux. * @history 2016-04-21 Makayla Shepherd - Added UnsignedWord pixel type handling. * @history 2018-01-29 Adam Goins - Added uint32_t behavior to EndianSwapper. */ class EndianSwapper { private: Loading @@ -67,6 +68,8 @@ namespace Isis { * byte format - all with swapped bytes. */ union { //! Union containing the output uint32_t value with swapped bytes. uint32_t p_uint32; //! Union containing the output double precision value with swapped bytes. double p_double; //! Union containing the output floating point value with swapped bytes. Loading @@ -93,6 +96,7 @@ namespace Isis { float Float(void *buf); int ExportFloat(void *buf); int Int(void *buf); uint32_t Uint32_t(void *buf); long long int LongLongInt(void *buf); short int ShortInt(void *buf); unsigned short int UnsignedShortInt(void *buf); Loading Loading
isis/src/base/objs/EndianSwapper/EndianSwapper.cpp +22 −1 Original line number Diff line number Diff line Loading @@ -138,6 +138,28 @@ namespace Isis { return result; } /** * Swaps a 32bit unsigned integer. * * @param buf Input uint32 integer value to swap. */ uint32_t EndianSwapper::Uint32_t(void *buf) { uint32_t result = *(uint32_t *)buf; if(p_needSwap) { char *ptr = (char *)buf + (sizeof(uint32_t) - 1) * p_needSwap; for(unsigned int i = 0; i < sizeof(uint32_t); i++) { p_swapper.p_char[i] = *ptr; ptr += p_swapDirection; } result = p_swapper.p_uint32; } return result; } /** * Swaps an 8 byte integer value. * Loading Loading @@ -203,4 +225,3 @@ namespace Isis { return result; } }
isis/src/base/objs/EndianSwapper/EndianSwapper.h +4 −0 Original line number Diff line number Diff line Loading @@ -50,6 +50,7 @@ namespace Isis { * not added because it is 4 bytes on 32-bit linux and 8 bytes on * 64-bit linux. * @history 2016-04-21 Makayla Shepherd - Added UnsignedWord pixel type handling. * @history 2018-01-29 Adam Goins - Added uint32_t behavior to EndianSwapper. */ class EndianSwapper { private: Loading @@ -67,6 +68,8 @@ namespace Isis { * byte format - all with swapped bytes. */ union { //! Union containing the output uint32_t value with swapped bytes. uint32_t p_uint32; //! Union containing the output double precision value with swapped bytes. double p_double; //! Union containing the output floating point value with swapped bytes. Loading @@ -93,6 +96,7 @@ namespace Isis { float Float(void *buf); int ExportFloat(void *buf); int Int(void *buf); uint32_t Uint32_t(void *buf); long long int LongLongInt(void *buf); short int ShortInt(void *buf); unsigned short int UnsignedShortInt(void *buf); Loading