Dr Andrew Scott G7VAV

My photo
 
June 2025
Mo Tu We Th Fr Sa Su
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 1 2 3 4 5 6


big_endian.h
001: #ifndef _LINUX_BYTEORDER_BIG_ENDIAN_H
002: #define _LINUX_BYTEORDER_BIG_ENDIAN_H
003: 
004: #ifndef __BIG_ENDIAN
005: #define __BIG_ENDIAN 4321
006: #endif
007: #ifndef __BIG_ENDIAN_BITFIELD
008: #define __BIG_ENDIAN_BITFIELD
009: #endif
010: 
011: #include <linux/types.h>
012: #include <linux/swab.h>
013: 
014: #define __constant_htonl(x) ((__be32)(__u32)(x))
015: #define __constant_ntohl(x) ((__u32)(__be32)(x))
016: #define __constant_htons(x) ((__be16)(__u16)(x))
017: #define __constant_ntohs(x) ((__u16)(__be16)(x))
018: #define __constant_cpu_to_le64(x) ((__le64)___constant_swab64((x)))
019: #define __constant_le64_to_cpu(x) ___constant_swab64((__u64)(__le64)(x))
020: #define __constant_cpu_to_le32(x) ((__le32)___constant_swab32((x)))
021: #define __constant_le32_to_cpu(x) ___constant_swab32((__u32)(__le32)(x))
022: #define __constant_cpu_to_le16(x) ((__le16)___constant_swab16((x)))
023: #define __constant_le16_to_cpu(x) ___constant_swab16((__u16)(__le16)(x))
024: #define __constant_cpu_to_be64(x) ((__be64)(__u64)(x))
025: #define __constant_be64_to_cpu(x) ((__u64)(__be64)(x))
026: #define __constant_cpu_to_be32(x) ((__be32)(__u32)(x))
027: #define __constant_be32_to_cpu(x) ((__u32)(__be32)(x))
028: #define __constant_cpu_to_be16(x) ((__be16)(__u16)(x))
029: #define __constant_be16_to_cpu(x) ((__u16)(__be16)(x))
030: #define __cpu_to_le64(x) ((__le64)__swab64((x)))
031: #define __le64_to_cpu(x) __swab64((__u64)(__le64)(x))
032: #define __cpu_to_le32(x) ((__le32)__swab32((x)))
033: #define __le32_to_cpu(x) __swab32((__u32)(__le32)(x))
034: #define __cpu_to_le16(x) ((__le16)__swab16((x)))
035: #define __le16_to_cpu(x) __swab16((__u16)(__le16)(x))
036: #define __cpu_to_be64(x) ((__be64)(__u64)(x))
037: #define __be64_to_cpu(x) ((__u64)(__be64)(x))
038: #define __cpu_to_be32(x) ((__be32)(__u32)(x))
039: #define __be32_to_cpu(x) ((__u32)(__be32)(x))
040: #define __cpu_to_be16(x) ((__be16)(__u16)(x))
041: #define __be16_to_cpu(x) ((__u16)(__be16)(x))
042: 
043: static __inline__ __le64 __cpu_to_le64p(const __u64 *p)
044: {
045:         return (__le64)__swab64p(p);
046: }
047: static __inline__ __u64 __le64_to_cpup(const __le64 *p)
048: {
049:         return __swab64p((__u64 *)p);
050: }
051: static __inline__ __le32 __cpu_to_le32p(const __u32 *p)
052: {
053:         return (__le32)__swab32p(p);
054: }
055: static __inline__ __u32 __le32_to_cpup(const __le32 *p)
056: {
057:         return __swab32p((__u32 *)p);
058: }
059: static __inline__ __le16 __cpu_to_le16p(const __u16 *p)
060: {
061:         return (__le16)__swab16p(p);
062: }
063: static __inline__ __u16 __le16_to_cpup(const __le16 *p)
064: {
065:         return __swab16p((__u16 *)p);
066: }
067: static __inline__ __be64 __cpu_to_be64p(const __u64 *p)
068: {
069:         return (__be64)*p;
070: }
071: static __inline__ __u64 __be64_to_cpup(const __be64 *p)
072: {
073:         return (__u64)*p;
074: }
075: static __inline__ __be32 __cpu_to_be32p(const __u32 *p)
076: {
077:         return (__be32)*p;
078: }
079: static __inline__ __u32 __be32_to_cpup(const __be32 *p)
080: {
081:         return (__u32)*p;
082: }
083: static __inline__ __be16 __cpu_to_be16p(const __u16 *p)
084: {
085:         return (__be16)*p;
086: }
087: static __inline__ __u16 __be16_to_cpup(const __be16 *p)
088: {
089:         return (__u16)*p;
090: }
091: #define __cpu_to_le64s(x) __swab64s((x))
092: #define __le64_to_cpus(x) __swab64s((x))
093: #define __cpu_to_le32s(x) __swab32s((x))
094: #define __le32_to_cpus(x) __swab32s((x))
095: #define __cpu_to_le16s(x) __swab16s((x))
096: #define __le16_to_cpus(x) __swab16s((x))
097: #define __cpu_to_be64s(x) do { (void)(x); } while (0)
098: #define __be64_to_cpus(x) do { (void)(x); } while (0)
099: #define __cpu_to_be32s(x) do { (void)(x); } while (0)
100: #define __be32_to_cpus(x) do { (void)(x); } while (0)
101: #define __cpu_to_be16s(x) do { (void)(x); } while (0)
102: #define __be16_to_cpus(x) do { (void)(x); } while (0)
103: 
104: 
105: #endif /* _LINUX_BYTEORDER_BIG_ENDIAN_H */
106: 


for client (none)
© Andrew Scott 2006 - 2025,
All Rights Reserved
http://www.andrew-scott.uk/
Andrew Scott
http://www.andrew-scott.co.uk/