use reflect fct

This commit is contained in:
iceman1001 2020-07-06 05:43:12 +02:00
parent 7d3cab1669
commit 927cd71ed9

View file

@ -128,24 +128,17 @@ uint64_t x_bytes_to_num(uint8_t *src, size_t len) {
return num;
}
uint8_t reversebytes(uint8_t b) {
b = (b & 0xF0) >> 4 | (b & 0x0F) << 4;
b = (b & 0xCC) >> 2 | (b & 0x33) << 2;
b = (b & 0xAA) >> 1 | (b & 0x55) << 1;
return b;
}
void reverse_arraybytes(uint8_t *arr, size_t len) {
uint8_t i;
for (i = 0; i < len ; i++) {
arr[i] = reversebytes(arr[i]);
arr[i] = reflect8(arr[i]);
}
}
void reverse_arraycopy(uint8_t *arr, uint8_t *dest, size_t len) {
uint8_t i;
for (i = 0; i < len ; i++) {
dest[i] = reversebytes(arr[i]);
dest[i] = reflect8(arr[i]);
}
}