aboutsummaryrefslogblamecommitdiffstats
path: root/libhashsum_reverse_byte__.c
blob: c608eb06e570e201fcd3c0ce4ac3276e7b247e7e (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
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;
}