diff -r f7be487d31b2 src/backend/APT/APTFileIO.cpp --- src/backend/APT/APTFileIO.cpp Sun Aug 27 05:07:02 2017 +0100 +++ src/backend/APT/APTFileIO.cpp Sun Aug 27 05:08:00 2017 +0100 @@ -22,6 +22,7 @@ #include "../../common/stringFuncs.h" #include "../../common/basics.h" #include "../../common/translation.h" +#include "../../common/endianTest.h" #include @@ -1230,9 +1231,9 @@ pt.switchEndian(); h.setPos(pt); - uint16_t s; - s =*( (uint16_t*)(buffer+12) ); - shortSwapBytes(s); + uint16_t *s; + s =( (uint16_t*)(buffer+12) ); + uint16_tSwapBytes(s); diff -r f7be487d31b2 src/backend/APT/ionhit.cpp --- src/backend/APT/ionhit.cpp Sun Aug 27 05:07:02 2017 +0100 +++ src/backend/APT/ionhit.cpp Sun Aug 27 05:08:00 2017 +0100 @@ -75,14 +75,12 @@ pos=p; } -#ifdef __LITTLE_ENDIAN__ void IonHit::switchEndian() { pos.switchEndian(); floatSwapBytes(&(massToCharge)); } -#endif const IonHit &IonHit::operator=(const IonHit &obj) { diff -r f7be487d31b2 src/backend/APT/ionhit.h --- src/backend/APT/ionhit.h Sun Aug 27 05:07:02 2017 +0100 +++ src/backend/APT/ionhit.h Sun Aug 27 05:08:00 2017 +0100 @@ -64,9 +64,8 @@ //returns true if any of the 4 data pts are +-inf bool hasInf(); -#ifdef __LITTLE_ENDIAN__ + //!Flip the endian of the point contained in this class void switchEndian(); -#endif //this does the endian switch for you //but you must supply a valid array. void makePosData(float *floatArr) const; diff -r f7be487d31b2 src/common/endianTest.h --- src/common/endianTest.h Sun Aug 27 05:07:02 2017 +0100 +++ src/common/endianTest.h Sun Aug 27 05:08:00 2017 +0100 @@ -25,10 +25,12 @@ #include #endif #endif +#include #ifdef __BYTE_ORDER //if both are not defined it is TRUE! -#if __BYTE_ORDER == __BIG_ENDIAN +// on F28 ppc64, is defined as __ORDER_BIG_ENDIAN +#if (__BYTE_ORDER == __BIG_ENDIAN) || (__BYTE_ORDER == __ORDER_BIG_ENDIAN) #ifndef __BIG_ENDIAN__ #define __BIG_ENDIAN__ #endif @@ -69,14 +71,14 @@ *inFloat=fb.f; } -inline void shortSwapBytes(short *inShort) +inline void uint16_tSwapBytes(uint16_t *inShort) { //Use a union to avoid strict-aliasing error - union ShortSwapUnion{ - short s; + union Uint16SwapUnion{ + uint16_t s; char c[2]; } ; - ShortSwapUnion sa,sb; + Uint16SwapUnion sa,sb; sa.s = *inShort; sb.c[0] = sa.c[1]; diff -r f7be487d31b2 src/common/mathfuncs.cpp --- src/common/mathfuncs.cpp Sun Aug 27 05:07:02 2017 +0100 +++ src/common/mathfuncs.cpp Sun Aug 27 05:08:00 2017 +0100 @@ -455,7 +455,6 @@ return true; } -#ifdef __LITTLE_ENDIAN__ void Point3D::switchEndian() { @@ -463,7 +462,6 @@ floatSwapBytes(&value[1]); floatSwapBytes(&value[2]); } -#endif std::ostream& operator<<(std::ostream &stream, const Point3D &pt) { diff -r f7be487d31b2 src/common/mathfuncs.h --- src/common/mathfuncs.h Sun Aug 27 05:07:02 2017 +0100 +++ src/common/mathfuncs.h Sun Aug 27 05:08:00 2017 +0100 @@ -174,10 +174,9 @@ static Point3D centroid(const Point3D *p, unsigned int n); static Point3D centroid(const std::vector &p); -#ifdef __LITTLE_ENDIAN__ - //!Flip the endian state for data stored in this point + + //!Flip the endian state for data stored in this point void switchEndian(); -#endif }; //IMPORTANT!!!