18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef __ASM_BITREV_H 38c2ecf20Sopenharmony_ci#define __ASM_BITREV_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_cistatic __always_inline __attribute_const__ u32 __arch_bitrev32(u32 x) 68c2ecf20Sopenharmony_ci{ 78c2ecf20Sopenharmony_ci __asm__ ("rbit %0, %1" : "=r" (x) : "r" (x)); 88c2ecf20Sopenharmony_ci return x; 98c2ecf20Sopenharmony_ci} 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_cistatic __always_inline __attribute_const__ u16 __arch_bitrev16(u16 x) 128c2ecf20Sopenharmony_ci{ 138c2ecf20Sopenharmony_ci return __arch_bitrev32((u32)x) >> 16; 148c2ecf20Sopenharmony_ci} 158c2ecf20Sopenharmony_ci 168c2ecf20Sopenharmony_cistatic __always_inline __attribute_const__ u8 __arch_bitrev8(u8 x) 178c2ecf20Sopenharmony_ci{ 188c2ecf20Sopenharmony_ci return __arch_bitrev32((u32)x) >> 24; 198c2ecf20Sopenharmony_ci} 208c2ecf20Sopenharmony_ci 218c2ecf20Sopenharmony_ci#endif 22