1 /**************************************************************************** 2 **************************************************************************** 3 *** 4 *** This header was automatically generated from a Linux kernel header 5 *** of the same name, to make information necessary for userspace to 6 *** call into the kernel available to libc. It contains only constants, 7 *** structures, and macros generated from the original header, and thus, 8 *** contains no copyrightable information. 9 *** 10 *** To edit the content of this header, modify the corresponding 11 *** source file (e.g. under external/kernel-headers/original/) then 12 *** run bionic/libc/kernel/tools/update_all.py 13 *** 14 *** Any manual change here will be lost the next time this script will 15 *** be run. You've been warned! 16 *** 17 **************************************************************************** 18 ****************************************************************************/ 19 #ifndef _LINUX_BYTEORDER_SWAB_H 20 #define _LINUX_BYTEORDER_SWAB_H 21 #include <linux/compiler.h> 22 #define ___swab16(x) ({ __u16 __x = (x); ((__u16)( (((__u16)(__x) & (__u16)0x00ffU) << 8) | (((__u16)(__x) & (__u16)0xff00U) >> 8) )); }) 23 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 24 #define ___swab32(x) ({ __u32 __x = (x); ((__u32)( (((__u32)(__x) & (__u32)0x000000ffUL) << 24) | (((__u32)(__x) & (__u32)0x0000ff00UL) << 8) | (((__u32)(__x) & (__u32)0x00ff0000UL) >> 8) | (((__u32)(__x) & (__u32)0xff000000UL) >> 24) )); }) 25 #define ___swab64(x) ({ __u64 __x = (x); ((__u64)( (__u64)(((__u64)(__x) & (__u64)0x00000000000000ffULL) << 56) | (__u64)(((__u64)(__x) & (__u64)0x000000000000ff00ULL) << 40) | (__u64)(((__u64)(__x) & (__u64)0x0000000000ff0000ULL) << 24) | (__u64)(((__u64)(__x) & (__u64)0x00000000ff000000ULL) << 8) | (__u64)(((__u64)(__x) & (__u64)0x000000ff00000000ULL) >> 8) | (__u64)(((__u64)(__x) & (__u64)0x0000ff0000000000ULL) >> 24) | (__u64)(((__u64)(__x) & (__u64)0x00ff000000000000ULL) >> 40) | (__u64)(((__u64)(__x) & (__u64)0xff00000000000000ULL) >> 56) )); }) 26 #define ___constant_swab16(x) ((__u16)( (((__u16)(x) & (__u16)0x00ffU) << 8) | (((__u16)(x) & (__u16)0xff00U) >> 8) )) 27 #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) )) 28 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 29 #define ___constant_swab64(x) ((__u64)( (__u64)(((__u64)(x) & (__u64)0x00000000000000ffULL) << 56) | (__u64)(((__u64)(x) & (__u64)0x000000000000ff00ULL) << 40) | (__u64)(((__u64)(x) & (__u64)0x0000000000ff0000ULL) << 24) | (__u64)(((__u64)(x) & (__u64)0x00000000ff000000ULL) << 8) | (__u64)(((__u64)(x) & (__u64)0x000000ff00000000ULL) >> 8) | (__u64)(((__u64)(x) & (__u64)0x0000ff0000000000ULL) >> 24) | (__u64)(((__u64)(x) & (__u64)0x00ff000000000000ULL) >> 40) | (__u64)(((__u64)(x) & (__u64)0xff00000000000000ULL) >> 56) )) 30 #ifndef __arch__swab16 31 #define __arch__swab16(x) ({ __u16 __tmp = (x) ; ___swab16(__tmp); }) 32 #endif 33 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 34 #ifndef __arch__swab32 35 #define __arch__swab32(x) ({ __u32 __tmp = (x) ; ___swab32(__tmp); }) 36 #endif 37 #ifndef __arch__swab64 38 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 39 #define __arch__swab64(x) ({ __u64 __tmp = (x) ; ___swab64(__tmp); }) 40 #endif 41 #ifndef __arch__swab16p 42 #define __arch__swab16p(x) __arch__swab16(*(x)) 43 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 44 #endif 45 #ifndef __arch__swab32p 46 #define __arch__swab32p(x) __arch__swab32(*(x)) 47 #endif 48 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 49 #ifndef __arch__swab64p 50 #define __arch__swab64p(x) __arch__swab64(*(x)) 51 #endif 52 #ifndef __arch__swab16s 53 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 54 #define __arch__swab16s(x) do { *(x) = __arch__swab16p((x)); } while (0) 55 #endif 56 #ifndef __arch__swab32s 57 #define __arch__swab32s(x) do { *(x) = __arch__swab32p((x)); } while (0) 58 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 59 #endif 60 #ifndef __arch__swab64s 61 #define __arch__swab64s(x) do { *(x) = __arch__swab64p((x)); } while (0) 62 #endif 63 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 64 #if defined(__GNUC__) && defined(__OPTIMIZE__) 65 #define __swab16(x) (__builtin_constant_p((__u16)(x)) ? ___swab16((x)) : __fswab16((x))) 66 #define __swab32(x) (__builtin_constant_p((__u32)(x)) ? ___swab32((x)) : __fswab32((x))) 67 #define __swab64(x) (__builtin_constant_p((__u64)(x)) ? ___swab64((x)) : __fswab64((x))) 68 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 69 #else 70 #define __swab16(x) __fswab16(x) 71 #define __swab32(x) __fswab32(x) 72 #define __swab64(x) __fswab64(x) 73 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 74 #endif 75 #ifdef __BYTEORDER_HAS_U64__ 76 #ifdef __SWAB_64_THRU_32__ 77 #else 78 /* WARNING: DO NOT EDIT, AUTO-GENERATED CODE - SEE TOP FOR INSTRUCTIONS */ 79 #endif 80 #endif 81 #endif 82