athena: Add a test for split-view controller.
[chromium-blink-merge.git] / third_party / lzma_sdk / 7zCrcOpt.c
blob6c766a209955e876928fe0fc17acf09cb22d1bea
1 /* 7zCrcOpt.c -- CRC32 calculation : optimized version
2 2009-11-23 : Igor Pavlov : Public domain */
4 #include "CpuArch.h"
6 #ifdef MY_CPU_LE
8 #define CRC_UPDATE_BYTE_2(crc, b) (table[((crc) ^ (b)) & 0xFF] ^ ((crc) >> 8))
10 UInt32 MY_FAST_CALL CrcUpdateT4(UInt32 v, const void *data, size_t size, const UInt32 *table)
12 const Byte *p = (const Byte *)data;
13 for (; size > 0 && ((unsigned)(ptrdiff_t)p & 3) != 0; size--, p++)
14 v = CRC_UPDATE_BYTE_2(v, *p);
15 for (; size >= 4; size -= 4, p += 4)
17 v ^= *(const UInt32 *)p;
18 v =
19 table[0x300 + (v & 0xFF)] ^
20 table[0x200 + ((v >> 8) & 0xFF)] ^
21 table[0x100 + ((v >> 16) & 0xFF)] ^
22 table[0x000 + ((v >> 24))];
24 for (; size > 0; size--, p++)
25 v = CRC_UPDATE_BYTE_2(v, *p);
26 return v;
29 UInt32 MY_FAST_CALL CrcUpdateT8(UInt32 v, const void *data, size_t size, const UInt32 *table)
31 return CrcUpdateT4(v, data, size, table);
34 #endif