xref: /kernel/linux/linux-5.10/arch/arm64/include/asm/bitrev.h (revision 8c2ecf20)
  • Home
  • History
  • Annotate Annotate
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
  • only in /kernel/linux/linux-5.10/arch/arm64/include/asm/
18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
28c2ecf20Sopenharmony_ci#ifndef __ASM_BITREV_H
38c2ecf20Sopenharmony_ci#define __ASM_BITREV_H
48c2ecf20Sopenharmony_cistatic __always_inline __attribute_const__ u32 __arch_bitrev32(u32 x)
58c2ecf20Sopenharmony_ci{
68c2ecf20Sopenharmony_ci	__asm__ ("rbit %w0, %w1" : "=r" (x) : "r" (x));
78c2ecf20Sopenharmony_ci	return x;
88c2ecf20Sopenharmony_ci}
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_cistatic __always_inline __attribute_const__ u16 __arch_bitrev16(u16 x)
118c2ecf20Sopenharmony_ci{
128c2ecf20Sopenharmony_ci	return __arch_bitrev32((u32)x) >> 16;
138c2ecf20Sopenharmony_ci}
148c2ecf20Sopenharmony_ci
158c2ecf20Sopenharmony_cistatic __always_inline __attribute_const__ u8 __arch_bitrev8(u8 x)
168c2ecf20Sopenharmony_ci{
178c2ecf20Sopenharmony_ci	return __arch_bitrev32((u32)x) >> 24;
188c2ecf20Sopenharmony_ci}
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#endif
21

Indexes created Thu Nov 07 10:32:03 CST 2024