Elliott Hughes | 180edef | 2023-11-02 00:08:05 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is auto-generated. Modifications will be lost. |
| 3 | * |
| 4 | * See https://android.googlesource.com/platform/bionic/+/master/libc/kernel/ |
| 5 | * for more information. |
| 6 | */ |
Ben Cheng | a6b53f0 | 2013-11-06 15:51:05 -0800 | [diff] [blame] | 7 | #ifndef _UAPI__ASM_ARM_SWAB_H |
| 8 | #define _UAPI__ASM_ARM_SWAB_H |
| 9 | #include <linux/compiler.h> |
| 10 | #include <linux/types.h> |
Ben Cheng | a6b53f0 | 2013-11-06 15:51:05 -0800 | [diff] [blame] | 11 | #ifndef __STRICT_ANSI__ |
| 12 | #define __SWAB_64_THRU_32__ |
| 13 | #endif |
Elliott Hughes | 8b95640 | 2024-10-28 17:51:26 +0000 | [diff] [blame] | 14 | static inline __attribute__((__const__)) __u32 __arch_swab32(__u32 x) { |
| 15 | __u32 t; |
Ben Cheng | a6b53f0 | 2013-11-06 15:51:05 -0800 | [diff] [blame] | 16 | #ifndef __thumb__ |
Elliott Hughes | 8b95640 | 2024-10-28 17:51:26 +0000 | [diff] [blame] | 17 | if(! __builtin_constant_p(x)) { |
| 18 | asm("eor\t%0, %1, %1, ror #16" : "=r" (t) : "r" (x)); |
| 19 | } else |
Ben Cheng | a6b53f0 | 2013-11-06 15:51:05 -0800 | [diff] [blame] | 20 | #endif |
Elliott Hughes | 8b95640 | 2024-10-28 17:51:26 +0000 | [diff] [blame] | 21 | t = x ^ ((x << 16) | (x >> 16)); |
| 22 | x = (x << 24) | (x >> 8); |
| 23 | t &= ~0x00FF0000; |
| 24 | x ^= (t >> 8); |
| 25 | return x; |
| 26 | } |
Ben Cheng | a6b53f0 | 2013-11-06 15:51:05 -0800 | [diff] [blame] | 27 | #define __arch_swab32 __arch_swab32 |
| 28 | #endif |