summaryrefslogtreecommitdiff
path: root/tinyusb/common/compiler
diff options
context:
space:
mode:
authorhathach <[email protected]>2014-01-24 21:51:24 +0700
committerhathach <[email protected]>2014-01-24 21:51:24 +0700
commita982a52ab39f4b3fa5b678a8aabba2f66f25518e (patch)
tree27dd5eda7e69769c6917636afbb191d1d078701f /tinyusb/common/compiler
parent275e834bbed4928094b0a631c7dd36fdcc0b40fe (diff)
refractor __n2be_16
Diffstat (limited to 'tinyusb/common/compiler')
-rw-r--r--tinyusb/common/compiler/compiler_gcc.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/tinyusb/common/compiler/compiler_gcc.h b/tinyusb/common/compiler/compiler_gcc.h
index 1733fab02..188ae271d 100644
--- a/tinyusb/common/compiler/compiler_gcc.h
+++ b/tinyusb/common/compiler/compiler_gcc.h
@@ -130,12 +130,14 @@
* @{
*/
-//#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
-// built-in function to convert 32-bit from native to Big Endian
-#define __be2n __builtin_bswap32
-#define __n2be __be2n
+// TODO mcu specific
+#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
+#define __n2be(x) __REV(x) ///< built-in function to convert 32-bit from native to Big Endian
+#define __be2n(x) __n2be(x) ///< built-in function to convert 32-bit from Big Endian to native
-//#define __le2be_16 __builtin_bswap16
+#define __n2be_16(u16) ((uint16_t) __REV16(u16))
+#define __be2n_16(u16) __n2be_16(u16)
+#endif
/** @} */