* 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. *****************************************************************************/
| 67 | * \return The reflected data. |
| 68 | *****************************************************************************/ |
| 69 | static 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. |