mirror of https://github.com/facebook/rocksdb.git
Merge pull request #71 from alberts/crc32
crc32c: choose function in static initialization
This commit is contained in:
commit
183ba01a0e
|
@ -333,17 +333,14 @@ static bool isSSE42() {
|
|||
}
|
||||
|
||||
typedef void (*Function)(uint64_t*, uint8_t const**);
|
||||
static Function func = nullptr;
|
||||
|
||||
static inline Function Choose_CRC32() {
|
||||
return isSSE42() ? Fast_CRC32 : Slow_CRC32;
|
||||
}
|
||||
|
||||
static Function func = Choose_CRC32();
|
||||
|
||||
static inline void CRC32(uint64_t* l, uint8_t const **p) {
|
||||
if (func != nullptr) {
|
||||
return func(l, p);
|
||||
}
|
||||
func = Choose_CRC32();
|
||||
func(l, p);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue