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 isis/src/base/objs/EndianSwapper/EndianSwapper.truth +1 −0 Original line number Diff line number Diff line Size of Double: 8 Double 0x12345678 to HOST: 3.0542e+08 Size of Float: 4 Float 0x1234 to HOST: 4660 Size of Uint32_t: 4 Uint32_t 0x1234 to HOST: 4660 Size of Short Int: 2 Short Int 0x1234 to HOST: 4660 Size of Unsigned Short Int: 2 Unsigned Short Int 0x1234 to HOST: 4660 Size of Double: 8 Double 0x12345678 to HOST: 2.55354e-312 Loading isis/src/base/objs/EndianSwapper/unitTest.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ int main(int argc, char *argv[]) { double DoubleValue; float FloatValue; uint32_t UIntValue; short int ShortIntValue; unsigned short int UShortIntValue; int IntValue; Loading @@ -19,6 +20,7 @@ int main(int argc, char *argv[]) { DoubleValue = 0x12345678; FloatValue = 0x1234; UIntValue = 0x1234; ShortIntValue = 0x1234; UShortIntValue = 0x1234; IntValue = 0x12345678; Loading @@ -30,6 +32,8 @@ int main(int argc, char *argv[]) { cout << " Double 0x12345678 to HOST: " << lsb.Double(&DoubleValue) << endl; cout << "Size of Float: " << sizeof(float); cout << " Float 0x1234 to HOST: " << lsb.Float(&FloatValue) << endl; cout << "Size of Uint32_t: " << sizeof(uint32_t); cout << " Uint32_t 0x1234 to HOST: " << lsb.Uint32_t(&UIntValue) << endl; cout << "Size of Short Int: " << sizeof(short int); cout << " Short Int 0x1234 to HOST: " << lsb.ShortInt(&ShortIntValue) << endl; cout << "Size of Unsigned Short Int: " << sizeof(unsigned short int); Loading Loading @@ -74,6 +78,8 @@ int main(int argc, char *argv[]) { cout << " Double 0x12345678 to HOST: " << msb.Double(&DoubleValue) << endl; cout << "Size of Float: " << sizeof(float); cout << " Float 0x1234 to HOST: " << msb.Float(&FloatValue) << endl; cout << "Size of Uint32_t: " << sizeof(uint32_t); cout << " Uint32_t 0x1234 to HOST: " << msb.Uint32_t(&UIntValue) << endl; cout << "Size of Short Int: " << sizeof(short int); cout << " Short Int 0x1234 to HOST: " << msb.ShortInt(&ShortIntValue) << endl; cout << "Size of Unsigned Short Int: " << sizeof(unsigned short int); Loading isis/src/control/apps/cnetbin2pvl/cnetbin2pvl.xml +2 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,8 @@ <description> <p> This program converts an Isis3 control network file from binary into a utf pvl formatted file. The output pvl will be written as the latest Pvl version. This program converts an Isis3 control network file from binary into a human readable utf8 pvl formatted file. The output pvl will be written as the latest Pvl version. The most recent Pvl template can be found in the Control data directory under templates/controlnetworks. </p> </description> 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
isis/src/base/objs/EndianSwapper/EndianSwapper.truth +1 −0 Original line number Diff line number Diff line Size of Double: 8 Double 0x12345678 to HOST: 3.0542e+08 Size of Float: 4 Float 0x1234 to HOST: 4660 Size of Uint32_t: 4 Uint32_t 0x1234 to HOST: 4660 Size of Short Int: 2 Short Int 0x1234 to HOST: 4660 Size of Unsigned Short Int: 2 Unsigned Short Int 0x1234 to HOST: 4660 Size of Double: 8 Double 0x12345678 to HOST: 2.55354e-312 Loading
isis/src/base/objs/EndianSwapper/unitTest.cpp +6 −0 Original line number Diff line number Diff line Loading @@ -12,6 +12,7 @@ int main(int argc, char *argv[]) { double DoubleValue; float FloatValue; uint32_t UIntValue; short int ShortIntValue; unsigned short int UShortIntValue; int IntValue; Loading @@ -19,6 +20,7 @@ int main(int argc, char *argv[]) { DoubleValue = 0x12345678; FloatValue = 0x1234; UIntValue = 0x1234; ShortIntValue = 0x1234; UShortIntValue = 0x1234; IntValue = 0x12345678; Loading @@ -30,6 +32,8 @@ int main(int argc, char *argv[]) { cout << " Double 0x12345678 to HOST: " << lsb.Double(&DoubleValue) << endl; cout << "Size of Float: " << sizeof(float); cout << " Float 0x1234 to HOST: " << lsb.Float(&FloatValue) << endl; cout << "Size of Uint32_t: " << sizeof(uint32_t); cout << " Uint32_t 0x1234 to HOST: " << lsb.Uint32_t(&UIntValue) << endl; cout << "Size of Short Int: " << sizeof(short int); cout << " Short Int 0x1234 to HOST: " << lsb.ShortInt(&ShortIntValue) << endl; cout << "Size of Unsigned Short Int: " << sizeof(unsigned short int); Loading Loading @@ -74,6 +78,8 @@ int main(int argc, char *argv[]) { cout << " Double 0x12345678 to HOST: " << msb.Double(&DoubleValue) << endl; cout << "Size of Float: " << sizeof(float); cout << " Float 0x1234 to HOST: " << msb.Float(&FloatValue) << endl; cout << "Size of Uint32_t: " << sizeof(uint32_t); cout << " Uint32_t 0x1234 to HOST: " << msb.Uint32_t(&UIntValue) << endl; cout << "Size of Short Int: " << sizeof(short int); cout << " Short Int 0x1234 to HOST: " << msb.ShortInt(&ShortIntValue) << endl; cout << "Size of Unsigned Short Int: " << sizeof(unsigned short int); Loading
isis/src/control/apps/cnetbin2pvl/cnetbin2pvl.xml +2 −2 Original line number Diff line number Diff line Loading @@ -7,8 +7,8 @@ <description> <p> This program converts an Isis3 control network file from binary into a utf pvl formatted file. The output pvl will be written as the latest Pvl version. This program converts an Isis3 control network file from binary into a human readable utf8 pvl formatted file. The output pvl will be written as the latest Pvl version. The most recent Pvl template can be found in the Control data directory under templates/controlnetworks. </p> </description> Loading