20#include <asm/byteorder.h>
22#elif defined(XRT_BIG_ENDIAN)
24#error "@todo: Add byte order constants and functions for this OS or big endian machines."
28#define __be64 uint64_t
29#define __be32 uint32_t
30#define __be16 uint16_t
32#define __be16_to_cpu(x) ((((uint16_t)x & (uint16_t)0x00FFU) << 8) | (((uint16_t)x & (uint16_t)0xFF00U) >> 8))
33#define __cpu_to_be16(x) __be16_to_cpu(x)
35#define __be32_to_cpu(x) \
36 ((((uint32_t)x & (uint32_t)0x000000FFUL) << 24) | (((uint32_t)x & (uint32_t)0x0000FF00UL) << 8) | \
37 (((uint32_t)x & (uint32_t)0x00FF0000UL) >> 8) | (((uint32_t)x & (uint32_t)0xFF000000UL) >> 24))
38#define __cpu_to_be32(x) __be32_to_cpu(x)
40#define __be64_to_cpu(x) \
41 ((((uint64_t)x & (uint64_t)0x00000000000000FFULL) << 56) | \
42 (((uint64_t)x & (uint64_t)0x000000000000FF00ULL) << 40) | \
43 (((uint64_t)x & (uint64_t)0x0000000000FF0000ULL) << 24) | \
44 (((uint64_t)x & (uint64_t)0x00000000FF000000ULL) << 8) | \
45 (((uint64_t)x & (uint64_t)0x000000FF00000000ULL) >> 8) | \
46 (((uint64_t)x & (uint64_t)0x0000FF0000000000ULL) >> 24) | \
47 (((uint64_t)x & (uint64_t)0x00FF000000000000ULL) >> 40) | \
48 (((uint64_t)x & (uint64_t)0xFF00000000000000ULL) >> 56))
49#define __cpu_to_be64(x) __be64_to_cpu(x)
51#define __le64 uint64_t
52#define __le32 uint32_t
53#define __le16 uint16_t
56#define __cpu_to_le16(x) (x)
57#define __le16_to_cpu(x) (x)
58#define __cpu_to_le32(x) (x)
59#define __le32_to_cpu(x) (x)
60#define __cpu_to_le64(x) (x)
61#define __le64_to_cpu(x) (x)
93 safe_copy.raw = __le32_to_cpu(f.val);
98__cpu_to_lef32(
float f)
107 return XRT_C11_COMPOUND(
__lef32){.val = __cpu_to_le32(safe_copy.wire)};
118 safe_copy.raw = __be32_to_cpu(f.val);
119 return safe_copy.f32;
123__cpu_to_bef32(
float f)
131 return XRT_C11_COMPOUND(
__bef32){.val = __cpu_to_be32(safe_copy.wire)};
162 safe_copy.raw = __le64_to_cpu(f.val);
163 return safe_copy.f64;
167__cpu_to_lef64(
double f)
176 return XRT_C11_COMPOUND(
__lef64){.val = __cpu_to_le64(safe_copy.wire)};
187 safe_copy.raw = __be64_to_cpu(f.val);
188 return safe_copy.f64;
192__cpu_to_bef64(
double f)
200 return XRT_C11_COMPOUND(
__bef64){.val = __cpu_to_be64(safe_copy.wire)};
218 return XRT_C11_COMPOUND(
struct xrt_vec2){
219 .x = __lef32_to_cpu(v.x),
220 .y = __lef32_to_cpu(v.y),
227 return XRT_C11_COMPOUND(
struct __levec2){
228 .x = __cpu_to_lef32(v.x),
229 .y = __cpu_to_lef32(v.y),
249 return XRT_C11_COMPOUND(
struct xrt_vec3){
250 .x = __lef32_to_cpu(v.x),
251 .y = __lef32_to_cpu(v.y),
252 .z = __lef32_to_cpu(v.z),
259 return XRT_C11_COMPOUND(
struct __levec3){
260 .x = __cpu_to_lef32(v.x),
261 .y = __cpu_to_lef32(v.y),
262 .z = __cpu_to_lef32(v.z),
Big endian 32-bit float wrapper struct.
Definition xrt_byte_order.h:81
Big endian 64-bit float wrapper struct.
Definition xrt_byte_order.h:150
Little endian 32-bit float wrapper struct.
Definition xrt_byte_order.h:73
Little endian 64-bit float wrapper struct.
Definition xrt_byte_order.h:142
Definition xrt_byte_order.h:210
Definition xrt_byte_order.h:240
A 2 element vector with single floats.
Definition xrt_defines.h:268
A 3 element vector with single floats.
Definition xrt_defines.h:289
Header holding common defines.
Common defines and enums for XRT.