Return a masked representation of crc. Motivation: it is problematic to compute the CRC of a string that contains embedded CRCs. Therefore we recommend that CRCs stored somewhere (e.g., in files) should be masked before being stored.
| 48 | // contains embedded CRCs. Therefore we recommend that CRCs stored |
| 49 | // somewhere (e.g., in files) should be masked before being stored. |
| 50 | inline uint32 Mask(uint32 crc) { |
| 51 | // Rotate right by 15 bits and add a constant. |
| 52 | return ((crc >> 15) | (crc << 17)) + kMaskDelta; |
| 53 | } |
| 54 | |
| 55 | // Return the crc whose masked representation is masked_crc. |
| 56 | inline uint32 Unmask(uint32 masked_crc) { |
no outgoing calls