summaryrefslogtreecommitdiff
path: root/inc/shared/shared.h
diff options
context:
space:
mode:
authorKent Overstreet <kent.overstreet@gmail.com>2017-01-24 14:15:25 -0900
committerKent Overstreet <kent.overstreet@gmail.com>2017-01-24 14:15:25 -0900
commit7f362ff033196b4c60f2c4279fd0f357844227b3 (patch)
treea8a46f27dc1b03bb1501fe41b1d1373e20b043d7 /inc/shared/shared.h
parent149617bab9a13c60e78009734b619f1c1238cd12 (diff)
Fewer globals
Diffstat (limited to 'inc/shared/shared.h')
-rw-r--r--inc/shared/shared.h10
1 files changed, 10 insertions, 0 deletions
diff --git a/inc/shared/shared.h b/inc/shared/shared.h
index d6633b2..8bbc736 100644
--- a/inc/shared/shared.h
+++ b/inc/shared/shared.h
@@ -427,6 +427,7 @@ static inline float FloatSwap(float f)
}
#if __BYTE_ORDER == __LITTLE_ENDIAN
+
#define BigShort ShortSwap
#define BigLong LongSwap
#define BigFloat FloatSwap
@@ -435,7 +436,12 @@ static inline float FloatSwap(float f)
#define LittleFloat(x) ((float)(x))
#define MakeRawLong(b1,b2,b3,b4) (((b4)<<24)|((b3)<<16)|((b2)<<8)|(b1))
#define MakeRawShort(b1,b2) (((b2)<<8)|(b1))
+
+#define le16_to_cpu(_x) ((uint16_t)(_x))
+#define le32_to_cpu(_x) ((uint32_t)(_x))
+
#elif __BYTE_ORDER == __BIG_ENDIAN
+
#define BigShort(x) ((uint16_t)(x))
#define BigLong(x) ((uint32_t)(x))
#define BigFloat(x) ((float)(x))
@@ -444,6 +450,10 @@ static inline float FloatSwap(float f)
#define LittleFloat FloatSwap
#define MakeRawLong(b1,b2,b3,b4) (((b1)<<24)|((b2)<<16)|((b3)<<8)|(b4))
#define MakeRawShort(b1,b2) (((b1)<<8)|(b2))
+
+#define le16_to_cpu(_x) ShortSwap(_x)
+#define le32_to_cpu(_x) LongSwap(_x)
+
#else
#error Unknown byte order
#endif