MCPcopy Create free account
hub / github.com/F-Stack/f-stack / crc_reflect

Function crc_reflect

app/redis-6.2.6/src/crc64.c:69–78  ·  view source on GitHub ↗

* Reflect all bits of a \a data word of \a data_len bytes. * * \param data The data word to be reflected. * \param data_len The width of \a data expressed in number of bits. * \return The reflected data. *****************************************************************************/

Source from the content-addressed store, hash-verified

67 * \return The reflected data.
68 *****************************************************************************/
69static inline uint_fast64_t crc_reflect(uint_fast64_t data, size_t data_len) {
70 uint_fast64_t ret = data & 0x01;
71
72 for (size_t i = 1; i < data_len; i++) {
73 data >>= 1;
74 ret = (ret << 1) | (data & 0x01);
75 }
76
77 return ret;
78}
79
80/**
81 * Update the crc value with new data.

Callers 1

_crc64Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected