summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathew Robinson <chasinglogic@gmail.com>2018-12-13 15:33:52 -0500
committerMathew Robinson <chasinglogic@gmail.com>2019-01-09 16:21:42 -0500
commitb52a4171ec2139856c7a058aec2bab525d7575dd (patch)
treebe717594219852775260551c69fb5f1b9b80762f /src
parent6f5396aad875d7c7e5c4653ba7158dfc33d82138 (diff)
downloadmongo-b52a4171ec2139856c7a058aec2bab525d7575dd.tar.gz
SERVER-28073 [Snappy-1.1.2 Patch]: prefer memcpy to undefined reinterpret_cast for UNALIGNED_LOAD/STORE functions
Diffstat (limited to 'src')
-rw-r--r--src/third_party/snappy-1.1.7/snappy-stubs-internal.h7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/third_party/snappy-1.1.7/snappy-stubs-internal.h b/src/third_party/snappy-1.1.7/snappy-stubs-internal.h
index cb605f82d0f..7b29991d1a2 100644
--- a/src/third_party/snappy-1.1.7/snappy-stubs-internal.h
+++ b/src/third_party/snappy-1.1.7/snappy-stubs-internal.h
@@ -110,7 +110,9 @@ static const int64 kint64max = static_cast<int64>(0x7FFFFFFFFFFFFFFFLL);
// x86, PowerPC, and ARM64 can simply do these loads and stores native.
-#if defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
+// MongoDB customization: Prefer memcpy on all architectures. Using reinterpret_cast is undefined
+// behavior.
+#if 0 && defined(__i386__) || defined(__x86_64__) || defined(__powerpc__) || \
defined(__aarch64__)
#define UNALIGNED_LOAD16(_p) (*reinterpret_cast<const uint16 *>(_p))
@@ -139,7 +141,8 @@ static const int64 kint64max = static_cast<int64>(0x7FFFFFFFFFFFFFFFLL);
// we can tell it that a _struct_ is unaligned, which has the same effect,
// so we do that.
-#elif defined(__arm__) && \
+// MongoDB customization: See memcpy notes above
+#elif 0 && defined(__arm__) && \
!defined(__ARM_ARCH_4__) && \
!defined(__ARM_ARCH_4T__) && \
!defined(__ARM_ARCH_5__) && \