* Update the crc value with new data. * * \param crc The current crc value. * \param data Pointer to a buffer of \a data_len bytes. * \param data_len Number of bytes in the \a data buffer. * \return The updated crc value. ******************************************************************************/
| 86 | * \return The updated crc value. |
| 87 | ******************************************************************************/ |
| 88 | uint64_t _crc64(uint_fast64_t crc, const void *in_data, const uint64_t len) { |
| 89 | const uint8_t *data = in_data; |
| 90 | unsigned long long bit; |
| 91 | |
| 92 | for (uint64_t offset = 0; offset < len; offset++) { |
| 93 | uint8_t c = data[offset]; |
| 94 | for (uint_fast8_t i = 0x01; i & 0xff; i <<= 1) { |
| 95 | bit = crc & 0x8000000000000000; |
| 96 | if (c & i) { |
| 97 | bit = !bit; |
| 98 | } |
| 99 | |
| 100 | crc <<= 1; |
| 101 | if (bit) { |
| 102 | crc ^= POLY; |
| 103 | } |
| 104 | } |
| 105 | |
| 106 | crc &= 0xffffffffffffffff; |
| 107 | } |
| 108 | |
| 109 | crc = crc & 0xffffffffffffffff; |
| 110 | return crc_reflect(crc, 64) ^ 0x0000000000000000; |
| 111 | } |
| 112 | |
| 113 | /******************** END GENERATED PYCRC FUNCTIONS ********************/ |
| 114 |
no test coverage detected