chg: adjusted the input parameters for crc16 implementations.

This commit is contained in:
iceman1001 2018-01-28 12:19:04 +01:00
commit 205e4b2300
8 changed files with 206 additions and 61 deletions

View file

@ -729,15 +729,6 @@ void rol(uint8_t *data, const size_t len){
data[len-1] = first;
}
// Swap bit order on a uint32_t value. Can be limited by 'b' just use say 8 bits reversal
// note: function clears the rest of the bits.
uint32_t SwapBits(uint32_t v, int b) {
uint32_t newvalue = 0;
for(int i = 0; i < b; i++) {
newvalue ^= ((v >> i) & 1) << (b - 1 - i);
}
return newvalue;
}
uint8_t reflect8(uint8_t b) {
return ((b * 0x80200802ULL) & 0x0884422110ULL) * 0x0101010101ULL >> 32;
}