• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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   */
7  #ifndef _UAPI_LINUX_SWAB_H
8  #define _UAPI_LINUX_SWAB_H
9  #include <linux/types.h>
10  #include <linux/stddef.h>
11  #include <asm/bitsperlong.h>
12  #include <asm/swab.h>
13  #define ___constant_swab16(x) ((__u16) ((((__u16) (x) & (__u16) 0x00ffU) << 8) | (((__u16) (x) & (__u16) 0xff00U) >> 8)))
14  #define ___constant_swab32(x) ((__u32) ((((__u32) (x) & (__u32) 0x000000ffUL) << 24) | (((__u32) (x) & (__u32) 0x0000ff00UL) << 8) | (((__u32) (x) & (__u32) 0x00ff0000UL) >> 8) | (((__u32) (x) & (__u32) 0xff000000UL) >> 24)))
15  #define ___constant_swab64(x) ((__u64) ((((__u64) (x) & (__u64) 0x00000000000000ffULL) << 56) | (((__u64) (x) & (__u64) 0x000000000000ff00ULL) << 40) | (((__u64) (x) & (__u64) 0x0000000000ff0000ULL) << 24) | (((__u64) (x) & (__u64) 0x00000000ff000000ULL) << 8) | (((__u64) (x) & (__u64) 0x000000ff00000000ULL) >> 8) | (((__u64) (x) & (__u64) 0x0000ff0000000000ULL) >> 24) | (((__u64) (x) & (__u64) 0x00ff000000000000ULL) >> 40) | (((__u64) (x) & (__u64) 0xff00000000000000ULL) >> 56)))
16  #define ___constant_swahw32(x) ((__u32) ((((__u32) (x) & (__u32) 0x0000ffffUL) << 16) | (((__u32) (x) & (__u32) 0xffff0000UL) >> 16)))
17  #define ___constant_swahb32(x) ((__u32) ((((__u32) (x) & (__u32) 0x00ff00ffUL) << 8) | (((__u32) (x) & (__u32) 0xff00ff00UL) >> 8)))
18  #ifdef __arch_swab16
19  #else
20  #endif
21  #ifdef __arch_swab32
22  #else
23  #endif
24  #ifdef __arch_swab64
25  #elif defined(__SWAB_64_THRU_32__)
26  #else
27  #endif
__fswahw32(__u32 val)28  static inline __attribute__((__const__)) __u32 __fswahw32(__u32 val) {
29  #ifdef __arch_swahw32
30    return __arch_swahw32(val);
31  #else
32    return ___constant_swahw32(val);
33  #endif
34  }
__fswahb32(__u32 val)35  static inline __attribute__((__const__)) __u32 __fswahb32(__u32 val) {
36  #ifdef __arch_swahb32
37    return __arch_swahb32(val);
38  #else
39    return ___constant_swahb32(val);
40  #endif
41  }
42  #define __swab16(x) (__u16) __builtin_bswap16((__u16) (x))
43  #define __swab32(x) (__u32) __builtin_bswap32((__u32) (x))
44  #define __swab64(x) (__u64) __builtin_bswap64((__u64) (x))
45  #if __BITS_PER_LONG == 64
46  #else
47  #endif
48  #define __swahw32(x) (__builtin_constant_p((__u32) (x)) ? ___constant_swahw32(x) : __fswahw32(x))
49  #define __swahb32(x) (__builtin_constant_p((__u32) (x)) ? ___constant_swahb32(x) : __fswahb32(x))
__swab16p(const __u16 * p)50  static __always_inline __u16 __swab16p(const __u16 * p) {
51  #ifdef __arch_swab16p
52    return __arch_swab16p(p);
53  #else
54    return __swab16(* p);
55  #endif
56  }
__swab32p(const __u32 * p)57  static __always_inline __u32 __swab32p(const __u32 * p) {
58  #ifdef __arch_swab32p
59    return __arch_swab32p(p);
60  #else
61    return __swab32(* p);
62  #endif
63  }
__swab64p(const __u64 * p)64  static __always_inline __u64 __swab64p(const __u64 * p) {
65  #ifdef __arch_swab64p
66    return __arch_swab64p(p);
67  #else
68    return __swab64(* p);
69  #endif
70  }
__swahw32p(const __u32 * p)71  static inline __u32 __swahw32p(const __u32 * p) {
72  #ifdef __arch_swahw32p
73    return __arch_swahw32p(p);
74  #else
75    return __swahw32(* p);
76  #endif
77  }
__swahb32p(const __u32 * p)78  static inline __u32 __swahb32p(const __u32 * p) {
79  #ifdef __arch_swahb32p
80    return __arch_swahb32p(p);
81  #else
82    return __swahb32(* p);
83  #endif
84  }
__swab16s(__u16 * p)85  static inline void __swab16s(__u16 * p) {
86  #ifdef __arch_swab16s
87    __arch_swab16s(p);
88  #else
89    * p = __swab16p(p);
90  #endif
91  }
__swab32s(__u32 * p)92  static __always_inline void __swab32s(__u32 * p) {
93  #ifdef __arch_swab32s
94    __arch_swab32s(p);
95  #else
96    * p = __swab32p(p);
97  #endif
98  }
__swab64s(__u64 * p)99  static __always_inline void __swab64s(__u64 * p) {
100  #ifdef __arch_swab64s
101    __arch_swab64s(p);
102  #else
103    * p = __swab64p(p);
104  #endif
105  }
__swahw32s(__u32 * p)106  static inline void __swahw32s(__u32 * p) {
107  #ifdef __arch_swahw32s
108    __arch_swahw32s(p);
109  #else
110    * p = __swahw32p(p);
111  #endif
112  }
__swahb32s(__u32 * p)113  static inline void __swahb32s(__u32 * p) {
114  #ifdef __arch_swahb32s
115    __arch_swahb32s(p);
116  #else
117    * p = __swahb32p(p);
118  #endif
119  }
120  #endif
121