mongodb/32bit-support.patch

46 lines
1.7 KiB
Diff

diff --git a/src/mongo/bson/bsonobjbuilder.h b/src/mongo/bson/bsonobjbuilder.h
index 38dae82..ee9b957 100644
--- a/src/mongo/bson/bsonobjbuilder.h
+++ b/src/mongo/bson/bsonobjbuilder.h
@@ -341,7 +341,7 @@ public:
return append(fieldName, d);
}
- BSONObjBuilder& appendNumber(StringData fieldName, size_t n) {
+ BSONObjBuilder& appendNumber(StringData fieldName, uint64_t n) {
static const size_t maxInt = (1 << 30);
if (n < maxInt)
append(fieldName, static_cast<int>(n));
@@ -350,6 +350,18 @@ public:
return *this;
}
+ /**
+ * Implement appendNumber for uint64_t and size_t on 32-bit platforms where
+ * these types differs. Typically for
+ * 32b: size_t ~ unsigned int; uint64_t ~ unsigned long long;
+ * 64b: size_t ~ unsigned long; uint64_t ~ unsigned long;
+ */
+ inline BSONObjBuilder& appendNumber(
+ StringData fieldName,
+ std::conditional<!std::is_same<uint64_t, size_t>::value, size_t, unsigned int>::type n) {
+ return appendNumber(fieldName, static_cast<uint64_t>(n));
+ }
+
BSONObjBuilder& appendNumber(StringData fieldName, Decimal128 decNumber) {
return append(fieldName, decNumber);
}
diff --git a/src/mongo/platform/pause.h b/src/mongo/platform/pause.h
index 46df146..5003de5 100644
--- a/src/mongo/platform/pause.h
+++ b/src/mongo/platform/pause.h
@@ -55,7 +55,7 @@
/* ori 0,0,0 is the PPC64 noop instruction */
#define MONGO_YIELD_CORE_FOR_SMT() __asm__ volatile("ori 0,0,0" ::: "memory")
-#elif defined(__aarch64__)
+#elif defined(__aarch64__) || defined(__arm__)
#define MONGO_YIELD_CORE_FOR_SMT() __asm__ volatile("yield" ::: "memory")