diff options
Diffstat (limited to 'lib/scudo/scudo_utils.h')
-rw-r--r-- | lib/scudo/scudo_utils.h | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/lib/scudo/scudo_utils.h b/lib/scudo/scudo_utils.h index 07394ff4b91d9..f93f26ef122aa 100644 --- a/lib/scudo/scudo_utils.h +++ b/lib/scudo/scudo_utils.h @@ -28,11 +28,11 @@ inline Dest bit_cast(const Source& source) { return dest; } -void dieWithMessage(const char *Format, ...); +void NORETURN dieWithMessage(const char *Format, ...); -enum CPUFeature { - SSE4_2 = 0, - ENUM_CPUFEATURE_MAX +enum CPUFeature { + CRC32CPUFeature = 0, + MaxCPUFeature, }; bool testCPUFeature(CPUFeature feature); @@ -42,18 +42,20 @@ struct Xorshift128Plus { public: Xorshift128Plus(); u64 Next() { - u64 x = State_0_; - const u64 y = State_1_; - State_0_ = y; + u64 x = State[0]; + const u64 y = State[1]; + State[0] = y; x ^= x << 23; - State_1_ = x ^ y ^ (x >> 17) ^ (y >> 26); - return State_1_ + y; + State[1] = x ^ y ^ (x >> 17) ^ (y >> 26); + return State[1] + y; } private: - u64 State_0_; - u64 State_1_; + u64 State[2]; }; -} // namespace __scudo +// Software CRC32 functions, to be used when SSE 4.2 support is not detected. +u32 computeCRC32(u32 Crc, uptr Data); + +} // namespace __scudo #endif // SCUDO_UTILS_H_ |