From fefa965f8dd1f52e727a316ddb86aa18b0cf495f Mon Sep 17 00:00:00 2001 From: auto-revert-processor Date: Wed, 5 Jan 2022 03:53:31 +0000 Subject: Revert "SERVER-62333 use std::ptrdiff_t to avoid UB in MurmurHash3" This reverts commit 863684a584bfa5b4beeffb8d2a79e735299c1de7. --- src/third_party/murmurhash3/MurmurHash3.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/third_party/murmurhash3/MurmurHash3.cpp b/src/third_party/murmurhash3/MurmurHash3.cpp index 5250e81268d..b877baf52a3 100644 --- a/src/third_party/murmurhash3/MurmurHash3.cpp +++ b/src/third_party/murmurhash3/MurmurHash3.cpp @@ -83,8 +83,6 @@ FORCE_INLINE T nativeToLittle( T t ) return t; } -template constexpr std::ptrdiff_t ssizeof = sizeof(T); - //----------------------------------------------------------------------------- // Block read - if your platform needs to do endian-swapping or can only // handle aligned reads, do the conversion here @@ -92,7 +90,7 @@ template FORCE_INLINE T getblock( const void* p, int i ) { T t; - std::memcpy(&t, static_cast(p) + i * ssizeof, sizeof(T)); + std::memcpy(&t, static_cast(p) + i * sizeof(T), sizeof(T)); return nativeToLittle(t); } @@ -111,7 +109,7 @@ template FORCE_INLINE void putblock( void* p, int i, T t ) { t = nativeToLittle(t); - std::memcpy(static_cast(p) + i * ssizeof, &t, sizeof(T)); + std::memcpy(static_cast(p) + i * sizeof(T), &t, sizeof(T)); } //----------------------------------------------------------------------------- -- cgit v1.2.1