1*f412fd2aSLoGin /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2*f412fd2aSLoGin #ifndef _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H 3*f412fd2aSLoGin #define _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H 4*f412fd2aSLoGin 5*f412fd2aSLoGin #ifndef __LITTLE_ENDIAN 6*f412fd2aSLoGin #define __LITTLE_ENDIAN 1234 7*f412fd2aSLoGin #endif 8*f412fd2aSLoGin #ifndef __LITTLE_ENDIAN_BITFIELD 9*f412fd2aSLoGin #define __LITTLE_ENDIAN_BITFIELD 10*f412fd2aSLoGin #endif 11*f412fd2aSLoGin 12*f412fd2aSLoGin #include "stddef.h" 13*f412fd2aSLoGin #include "../types.h" 14*f412fd2aSLoGin #include <linux/swab.h> 15*f412fd2aSLoGin 16*f412fd2aSLoGin #define __constant_htonl(x) ((__force __be32)___constant_swab32((x))) 17*f412fd2aSLoGin #define __constant_ntohl(x) ___constant_swab32((__force __be32)(x)) 18*f412fd2aSLoGin #define __constant_htons(x) ((__force __be16)___constant_swab16((x))) 19*f412fd2aSLoGin #define __constant_ntohs(x) ___constant_swab16((__force __be16)(x)) 20*f412fd2aSLoGin #define __constant_cpu_to_le64(x) ((__force __le64)(__u64)(x)) 21*f412fd2aSLoGin #define __constant_le64_to_cpu(x) ((__force __u64)(__le64)(x)) 22*f412fd2aSLoGin #define __constant_cpu_to_le32(x) ((__force __le32)(__u32)(x)) 23*f412fd2aSLoGin #define __constant_le32_to_cpu(x) ((__force __u32)(__le32)(x)) 24*f412fd2aSLoGin #define __constant_cpu_to_le16(x) ((__force __le16)(__u16)(x)) 25*f412fd2aSLoGin #define __constant_le16_to_cpu(x) ((__force __u16)(__le16)(x)) 26*f412fd2aSLoGin #define __constant_cpu_to_be64(x) ((__force __be64)___constant_swab64((x))) 27*f412fd2aSLoGin #define __constant_be64_to_cpu(x) ___constant_swab64((__force __u64)(__be64)(x)) 28*f412fd2aSLoGin #define __constant_cpu_to_be32(x) ((__force __be32)___constant_swab32((x))) 29*f412fd2aSLoGin #define __constant_be32_to_cpu(x) ___constant_swab32((__force __u32)(__be32)(x)) 30*f412fd2aSLoGin #define __constant_cpu_to_be16(x) ((__force __be16)___constant_swab16((x))) 31*f412fd2aSLoGin #define __constant_be16_to_cpu(x) ___constant_swab16((__force __u16)(__be16)(x)) 32*f412fd2aSLoGin #define __cpu_to_le64(x) ((__force __le64)(__u64)(x)) 33*f412fd2aSLoGin #define __le64_to_cpu(x) ((__force __u64)(__le64)(x)) 34*f412fd2aSLoGin #define __cpu_to_le32(x) ((__force __le32)(__u32)(x)) 35*f412fd2aSLoGin #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) 36*f412fd2aSLoGin #define __cpu_to_le16(x) ((__force __le16)(__u16)(x)) 37*f412fd2aSLoGin #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) 38*f412fd2aSLoGin #define __cpu_to_be64(x) ((__force __be64)__swab64((x))) 39*f412fd2aSLoGin #define __be64_to_cpu(x) __swab64((__force __u64)(__be64)(x)) 40*f412fd2aSLoGin #define __cpu_to_be32(x) ((__force __be32)__swab32((x))) 41*f412fd2aSLoGin #define __be32_to_cpu(x) __swab32((__force __u32)(__be32)(x)) 42*f412fd2aSLoGin #define __cpu_to_be16(x) ((__force __be16)__swab16((x))) 43*f412fd2aSLoGin #define __be16_to_cpu(x) __swab16((__force __u16)(__be16)(x)) 44*f412fd2aSLoGin __cpu_to_le64p(const __u64 * p)45*f412fd2aSLoGinstatic __always_inline __le64 __cpu_to_le64p(const __u64 *p) 46*f412fd2aSLoGin { 47*f412fd2aSLoGin return (__force __le64)*p; 48*f412fd2aSLoGin } __le64_to_cpup(const __le64 * p)49*f412fd2aSLoGinstatic __always_inline __u64 __le64_to_cpup(const __le64 *p) 50*f412fd2aSLoGin { 51*f412fd2aSLoGin return (__force __u64)*p; 52*f412fd2aSLoGin } __cpu_to_le32p(const __u32 * p)53*f412fd2aSLoGinstatic __always_inline __le32 __cpu_to_le32p(const __u32 *p) 54*f412fd2aSLoGin { 55*f412fd2aSLoGin return (__force __le32)*p; 56*f412fd2aSLoGin } __le32_to_cpup(const __le32 * p)57*f412fd2aSLoGinstatic __always_inline __u32 __le32_to_cpup(const __le32 *p) 58*f412fd2aSLoGin { 59*f412fd2aSLoGin return (__force __u32)*p; 60*f412fd2aSLoGin } __cpu_to_le16p(const __u16 * p)61*f412fd2aSLoGinstatic __always_inline __le16 __cpu_to_le16p(const __u16 *p) 62*f412fd2aSLoGin { 63*f412fd2aSLoGin return (__force __le16)*p; 64*f412fd2aSLoGin } __le16_to_cpup(const __le16 * p)65*f412fd2aSLoGinstatic __always_inline __u16 __le16_to_cpup(const __le16 *p) 66*f412fd2aSLoGin { 67*f412fd2aSLoGin return (__force __u16)*p; 68*f412fd2aSLoGin } __cpu_to_be64p(const __u64 * p)69*f412fd2aSLoGinstatic __always_inline __be64 __cpu_to_be64p(const __u64 *p) 70*f412fd2aSLoGin { 71*f412fd2aSLoGin return (__force __be64)__swab64p(p); 72*f412fd2aSLoGin } __be64_to_cpup(const __be64 * p)73*f412fd2aSLoGinstatic __always_inline __u64 __be64_to_cpup(const __be64 *p) 74*f412fd2aSLoGin { 75*f412fd2aSLoGin return __swab64p((__u64 *)p); 76*f412fd2aSLoGin } __cpu_to_be32p(const __u32 * p)77*f412fd2aSLoGinstatic __always_inline __be32 __cpu_to_be32p(const __u32 *p) 78*f412fd2aSLoGin { 79*f412fd2aSLoGin return (__force __be32)__swab32p(p); 80*f412fd2aSLoGin } __be32_to_cpup(const __be32 * p)81*f412fd2aSLoGinstatic __always_inline __u32 __be32_to_cpup(const __be32 *p) 82*f412fd2aSLoGin { 83*f412fd2aSLoGin return __swab32p((__u32 *)p); 84*f412fd2aSLoGin } __cpu_to_be16p(const __u16 * p)85*f412fd2aSLoGinstatic __always_inline __be16 __cpu_to_be16p(const __u16 *p) 86*f412fd2aSLoGin { 87*f412fd2aSLoGin return (__force __be16)__swab16p(p); 88*f412fd2aSLoGin } __be16_to_cpup(const __be16 * p)89*f412fd2aSLoGinstatic __always_inline __u16 __be16_to_cpup(const __be16 *p) 90*f412fd2aSLoGin { 91*f412fd2aSLoGin return __swab16p((__u16 *)p); 92*f412fd2aSLoGin } 93*f412fd2aSLoGin #define __cpu_to_le64s(x) do { (void)(x); } while (0) 94*f412fd2aSLoGin #define __le64_to_cpus(x) do { (void)(x); } while (0) 95*f412fd2aSLoGin #define __cpu_to_le32s(x) do { (void)(x); } while (0) 96*f412fd2aSLoGin #define __le32_to_cpus(x) do { (void)(x); } while (0) 97*f412fd2aSLoGin #define __cpu_to_le16s(x) do { (void)(x); } while (0) 98*f412fd2aSLoGin #define __le16_to_cpus(x) do { (void)(x); } while (0) 99*f412fd2aSLoGin #define __cpu_to_be64s(x) __swab64s((x)) 100*f412fd2aSLoGin #define __be64_to_cpus(x) __swab64s((x)) 101*f412fd2aSLoGin #define __cpu_to_be32s(x) __swab32s((x)) 102*f412fd2aSLoGin #define __be32_to_cpus(x) __swab32s((x)) 103*f412fd2aSLoGin #define __cpu_to_be16s(x) __swab16s((x)) 104*f412fd2aSLoGin #define __be16_to_cpus(x) __swab16s((x)) 105*f412fd2aSLoGin 106*f412fd2aSLoGin 107*f412fd2aSLoGin #endif /* _UAPI_LINUX_BYTEORDER_LITTLE_ENDIAN_H */