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 **************************************************************************** 11 ****************************************************************************/ 12 #ifndef _LINUX_BYTEORDER_SWABB_H 13 #define _LINUX_BYTEORDER_SWABB_H 14 15 #define ___swahw32(x) ({ __u32 __x = (x); ((__u32)( (((__u32)(__x) & (__u32)0x0000ffffUL) << 16) | (((__u32)(__x) & (__u32)0xffff0000UL) >> 16) )); }) 16 #define ___swahb32(x) ({ __u32 __x = (x); ((__u32)( (((__u32)(__x) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(__x) & (__u32)0xff00ff00UL) >> 8) )); }) 17 18 #define ___constant_swahw32(x) ((__u32)( (((__u32)(x) & (__u32)0x0000ffffUL) << 16) | (((__u32)(x) & (__u32)0xffff0000UL) >> 16) )) 19 #define ___constant_swahb32(x) ((__u32)( (((__u32)(x) & (__u32)0x00ff00ffUL) << 8) | (((__u32)(x) & (__u32)0xff00ff00UL) >> 8) )) 20 21 #ifndef __arch__swahw32 22 #define __arch__swahw32(x) ___swahw32(x) 23 #endif 24 #ifndef __arch__swahb32 25 #define __arch__swahb32(x) ___swahb32(x) 26 #endif 27 28 #ifndef __arch__swahw32p 29 #define __arch__swahw32p(x) __swahw32(*(x)) 30 #endif 31 #ifndef __arch__swahb32p 32 #define __arch__swahb32p(x) __swahb32(*(x)) 33 #endif 34 35 #ifndef __arch__swahw32s 36 #define __arch__swahw32s(x) do { *(x) = __swahw32p((x)); } while (0) 37 #endif 38 #ifndef __arch__swahb32s 39 #define __arch__swahb32s(x) do { *(x) = __swahb32p((x)); } while (0) 40 #endif 41 42 #if defined(__GNUC__) && defined(__OPTIMIZE__) 43 #define __swahw32(x) (__builtin_constant_p((__u32)(x)) ? ___swahw32((x)) : __fswahw32((x))) 44 #define __swahb32(x) (__builtin_constant_p((__u32)(x)) ? ___swahb32((x)) : __fswahb32((x))) 45 #else 46 #define __swahw32(x) __fswahw32(x) 47 #define __swahb32(x) __fswahb32(x) 48 #endif 49 50 #ifdef __BYTEORDER_HAS_U64__ 51 #endif 52 #endif 53