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