MCPcopy Create free account
hub / github.com/ElementsProject/elements / CanAccelerateCRC32C

Function CanAccelerateCRC32C

src/leveldb/util/crc32c.cc:267–274  ·  view source on GitHub ↗

Determine if the CPU running this program can accelerate the CRC32C calculation.

Source from the content-addressed store, hash-verified

265// Determine if the CPU running this program can accelerate the CRC32C
266// calculation.
267static bool CanAccelerateCRC32C() {
268 // port::AcceleretedCRC32C returns zero when unable to accelerate.
269 static const char kTestCRCBuffer[] = "TestCRCBuffer";
270 static const char kBufSize = sizeof(kTestCRCBuffer) - 1;
271 static const uint32_t kTestCRCValue = 0xdcbc59fa;
272
273 return port::AcceleratedCRC32C(0, kTestCRCBuffer, kBufSize) == kTestCRCValue;
274}
275
276uint32_t Extend(uint32_t crc, const char* data, size_t n) {
277 static bool accelerate = CanAccelerateCRC32C();

Callers 1

ExtendFunction · 0.85

Calls 1

AcceleratedCRC32CFunction · 0.85

Tested by

no test coverage detected