mirror of
https://github.com/hathach/tinyusb.git
synced 2025-02-22 15:40:06 +00:00
Merge pull request #2033 from ReimuNotMoe/master
Fix compatibility with the latest Microchip XC16 compiler
This commit is contained in:
commit
9771c76f25
@ -138,10 +138,14 @@
|
|||||||
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
|
||||||
#define TU_ATTR_BIT_FIELD_ORDER_END
|
#define TU_ATTR_BIT_FIELD_ORDER_END
|
||||||
|
|
||||||
#if __has_attribute(__fallthrough__)
|
#if __GNUC__ < 5
|
||||||
#define TU_ATTR_FALLTHROUGH __attribute__((fallthrough))
|
|
||||||
#else
|
|
||||||
#define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */
|
#define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */
|
||||||
|
#else
|
||||||
|
#if __has_attribute(__fallthrough__)
|
||||||
|
#define TU_ATTR_FALLTHROUGH __attribute__((fallthrough))
|
||||||
|
#else
|
||||||
|
#define TU_ATTR_FALLTHROUGH do {} while (0) /* fallthrough */
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Endian conversion use well-known host to network (big endian) naming
|
// Endian conversion use well-known host to network (big endian) naming
|
||||||
@ -151,8 +155,17 @@
|
|||||||
#define TU_BYTE_ORDER TU_BIG_ENDIAN
|
#define TU_BYTE_ORDER TU_BIG_ENDIAN
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define TU_BSWAP16(u16) (__builtin_bswap16(u16))
|
// Unfortunately XC16 doesn't provide builtins for 32bit endian conversion
|
||||||
#define TU_BSWAP32(u32) (__builtin_bswap32(u32))
|
#if defined(__XC16)
|
||||||
|
#define TU_BSWAP16(u16) (__builtin_swap(u16))
|
||||||
|
#define TU_BSWAP32(u32) ((((u32) & 0xff000000) >> 24) | \
|
||||||
|
(((u32) & 0x00ff0000) >> 8) | \
|
||||||
|
(((u32) & 0x0000ff00) << 8) | \
|
||||||
|
(((u32) & 0x000000ff) << 24))
|
||||||
|
#else
|
||||||
|
#define TU_BSWAP16(u16) (__builtin_bswap16(u16))
|
||||||
|
#define TU_BSWAP32(u32) (__builtin_bswap32(u32))
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef __ARMCC_VERSION
|
#ifndef __ARMCC_VERSION
|
||||||
// List of obsolete callback function that is renamed and should not be defined.
|
// List of obsolete callback function that is renamed and should not be defined.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user