diff options
Diffstat (limited to 'libhashsum_reverse_byte__.c')
-rw-r--r-- | libhashsum_reverse_byte__.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libhashsum_reverse_byte__.c b/libhashsum_reverse_byte__.c new file mode 100644 index 0000000..c608eb0 --- /dev/null +++ b/libhashsum_reverse_byte__.c @@ -0,0 +1,12 @@ +/* See LICENSE file for copyright and license details. */ +#include "common.h" + + +uint8_t +libhashsum_reverse_byte__(uint8_t x) +{ + x = (uint8_t)(((x & 0xAAU) >> 1) | ((x << 1) & 0xAAU)); + x = (uint8_t)(((x & 0xCCU) >> 2) | ((x << 2) & 0xCCU)); + x = (uint8_t)(((x & 0xF0U) >> 4) | ((x << 4) & 0xF0U)); + return x; +} |