Conditions | 4 |
Total Lines | 18 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | """Implements the _Crc64Calculator class. |
||
38 | def _construct_lookup_table(self, polynomial): |
||
39 | """Precomputes a CRC-64 lookup table seeded from the supplied polynomial. |
||
40 | No return value. |
||
41 | """ |
||
42 | |||
43 | self._lookup_table = [] |
||
44 | |||
45 | for i in range(0, 256): |
||
46 | lookup_value = i |
||
47 | |||
48 | for _ in range(0, 8): |
||
49 | if lookup_value & 0x1 == 0x1: |
||
50 | lookup_value = (lookup_value >> 1) ^ polynomial |
||
51 | |||
52 | else: |
||
53 | lookup_value = lookup_value >> 1 |
||
54 | |||
55 | self._lookup_table.append(lookup_value) |
||
56 |