diff --git a/setup.py b/setup.py index aa5cbe31..ac0e312f 100644 --- a/setup.py +++ b/setup.py @@ -47,7 +47,7 @@ extra_compile_args += ['-march=native',] if os.name != 'nt': - extra_compile_args += ['-O3', '-ffast-math', '-fno-associative-math'] + extra_compile_args += ['-O3'] # Add multithreaded build flag for all platforms using Python 3 and # for non-Windows Python 2 platforms diff --git a/src/annoylib.h b/src/annoylib.h index 657977cb..c10aca30 100644 --- a/src/annoylib.h +++ b/src/annoylib.h @@ -470,7 +470,7 @@ struct Angular : Base { T norm; }; T v[ANNOYLIB_V_ARRAY_SIZE]; - }; + } __attribute__((__packed__)); template static inline T distance(const Node* x, const Node* y, int f) { // want to calculate (a/|a| - b/|b|)^2 @@ -549,7 +549,7 @@ struct DotProduct : Angular { T norm; bool built; T v[ANNOYLIB_V_ARRAY_SIZE]; - }; + } __attribute__((__packed__)); static const char* name() { return "dot"; @@ -709,8 +709,7 @@ struct Hamming : Base { S n_descendants; S children[2]; T v[ANNOYLIB_V_ARRAY_SIZE]; - }; - + } __attribute__((__packed__)); static const size_t max_iterations = 20; template @@ -810,7 +809,7 @@ struct Minkowski : Base { T a; // need an extra constant term to determine the offset of the plane S children[2]; T v[ANNOYLIB_V_ARRAY_SIZE]; - }; + } __attribute__((__packed__)); template static inline T margin(const Node* n, const T* y, int f) { return n->a + dot(n->v, y, f);