Zephyr Project API 4.4.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
bit_rev.h
Go to the documentation of this file.
1/*
2 * SPDX-FileCopyrightText: Copyright The Zephyr Project Contributors
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef ZEPHYR_INCLUDE_ARCH_ARM64_BIT_REV_H_
8#define ZEPHYR_INCLUDE_ARCH_ARM64_BIT_REV_H_
9
10#ifndef _ASMLANGUAGE
11
12#include <zephyr/types.h>
13#include <zephyr/sys/util.h>
14
15#ifdef __cplusplus
16extern "C" {
17#endif
18
25
26#if defined(CONFIG_ARCH_HAS_BIT_REV) || defined(__DOXYGEN__)
27
36{
37 __asm__("rbit %w0, %w1" : "=r"(x) : "r"(x));
38 return x;
39}
40
49{
50 return arch_sys_bit_rev32(x) >> 16;
51}
52
61{
62 return arch_sys_bit_rev32(x) >> 24;
63}
64
65#endif /* defined(CONFIG_ARCH_HAS_BIT_REV) || defined(__DOXYGEN__) */
66
70
71#ifdef __cplusplus
72}
73#endif
74
75#endif /* !_ASMLANGUAGE */
76#endif /* ZEPHYR_INCLUDE_ARCH_ARM64_BIT_REV_H_ */
static uint16_t arch_sys_bit_rev16(uint16_t x)
Reverse the bits in a 16-bit value.
Definition bit_rev.h:48
static uint8_t arch_sys_bit_rev8(uint8_t x)
Reverse the bits in an 8-bit value.
Definition bit_rev.h:60
static uint32_t arch_sys_bit_rev32(uint32_t x)
Reverse the bits in a 32-bit value.
Definition bit_rev.h:36
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
__UINT8_TYPE__ uint8_t
Definition stdint.h:88
__UINT16_TYPE__ uint16_t
Definition stdint.h:89
Misc utilities.