xref: /openbmc/u-boot/include/linux/bitrev.h (revision 0dd9c7a924f9a7b15fdb15d9005fd5506965f49f)
1*0dd9c7a9SMike Dunn /*
2*0dd9c7a9SMike Dunn  * This file is released under the terms of GPL v2 and any later version.
3*0dd9c7a9SMike Dunn  * See the file COPYING in the root directory of the source tree for details.
4*0dd9c7a9SMike Dunn  *
5*0dd9c7a9SMike Dunn  * Based on bitrev from the Linux kernel, by Akinobu Mita
6*0dd9c7a9SMike Dunn  */
7*0dd9c7a9SMike Dunn 
8*0dd9c7a9SMike Dunn #ifndef _LINUX_BITREV_H
9*0dd9c7a9SMike Dunn #define _LINUX_BITREV_H
10*0dd9c7a9SMike Dunn 
11*0dd9c7a9SMike Dunn #include <linux/types.h>
12*0dd9c7a9SMike Dunn 
13*0dd9c7a9SMike Dunn extern u8 const byte_rev_table[256];
14*0dd9c7a9SMike Dunn 
15*0dd9c7a9SMike Dunn static inline u8 bitrev8(u8 byte)
16*0dd9c7a9SMike Dunn {
17*0dd9c7a9SMike Dunn 	return byte_rev_table[byte];
18*0dd9c7a9SMike Dunn }
19*0dd9c7a9SMike Dunn 
20*0dd9c7a9SMike Dunn u16 bitrev16(u16 in);
21*0dd9c7a9SMike Dunn u32 bitrev32(u32 in);
22*0dd9c7a9SMike Dunn 
23*0dd9c7a9SMike Dunn #endif /* _LINUX_BITREV_H */
24