PKGBUILDs/community/mongodb/0006-Fix-ARM-alignment-problems.patch
2014-04-13 16:45:05 +00:00

52 lines
1.7 KiB
Diff

diff -urN a/src/mongo/bson/bsonelement.h b/src/mongo/bson/bsonelement.h
--- a/src/mongo/bson/bsonelement.h 2014-04-06 18:36:57.000000000 -0600
+++ b/src/mongo/bson/bsonelement.h 2014-04-13 10:29:45.602177312 -0600
@@ -17,7 +17,7 @@
#pragma once
-#include <string.h> // strlen
+#include <string.h> // strlen, memcpy
#include <string>
#include <vector>
@@ -550,13 +550,27 @@
}
inline double BSONElement::numberDouble() const {
+#if defined(__arm__)
+ int int_result;
+ long long long_long_result;
+#endif
switch( type() ) {
case NumberDouble:
return _numberDouble();
case NumberInt:
+#if defined(__arm__)
+ memcpy(&int_result, value(), sizeof(int_result));
+ return int_result;
+#else
return *reinterpret_cast< const int* >( value() );
+#endif
case NumberLong:
+#if defined(__arm__)
+ memcpy(&long_long_result, value(), sizeof(long_long_result));
+ return (double)long_long_result;
+#else
return (double) *reinterpret_cast< const long long* >( value() );
+#endif
default:
return 0;
}
diff -urN a/src/mongo/db/structure/btree/key.cpp b/src/mongo/db/structure/btree/key.cpp
--- a/src/mongo/db/structure/btree/key.cpp 2014-04-06 18:36:57.000000000 -0600
+++ b/src/mongo/db/structure/btree/key.cpp 2014-04-13 10:30:54.586913327 -0600
@@ -418,7 +418,7 @@
p += 8;
break;
case cdouble:
- b.append("", (double&) *p);
+ b.append("", (reinterpret_cast< const PackedDouble& >(*p)).d);
p += sizeof(double);
break;
case cint: