Pass by reference the first argument of ExtractLowBytes

to avoid UB of passing uninitialized argument by value.

PiperOrigin-RevId: 406052814
This commit is contained in:
Snappy Team
2021-10-28 04:39:14 +00:00
committed by Victor Costan
parent fe18b46322
commit 65dc7b3839

View File

@@ -954,7 +954,7 @@ static inline void Report(const char *algorithm, size_t compressed_size,
// bool TryFastAppend(const char* ip, size_t available, size_t length, T* op); // bool TryFastAppend(const char* ip, size_t available, size_t length, T* op);
// }; // };
static inline uint32_t ExtractLowBytes(uint32_t v, int n) { static inline uint32_t ExtractLowBytes(const uint32_t& v, int n) {
assert(n >= 0); assert(n >= 0);
assert(n <= 4); assert(n <= 4);
#if SNAPPY_HAVE_BMI2 #if SNAPPY_HAVE_BMI2