1 ///////////////////////////////////////////////////////////////////////////////
3 /// \file crc64_small.c
4 /// \brief CRC64 calculation (size-optimized)
6 // This code has been put into the public domain.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12 ///////////////////////////////////////////////////////////////////////////////
17 static uint64_t crc64_table[256];
23 static const uint64_t poly64 = UINT64_C(0xC96C5795D7870F42);
25 for (size_t b = 0; b < 256; ++b) {
27 for (size_t i = 0; i < 8; ++i) {
29 r = (r >> 1) ^ poly64;
41 extern LZMA_API(uint64_t)
42 lzma_crc64(const uint8_t *buf, size_t size, uint64_t crc)
44 mythread_once(crc64_init);
49 crc = crc64_table[*buf++ ^ (crc & 0xFF)] ^ (crc >> 8);