File tree Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Expand file tree Collapse file tree 1 file changed +11
-2
lines changed Original file line number Diff line number Diff line change 155
155
#define TU_BYTE_ORDER TU_BIG_ENDIAN
156
156
#endif
157
157
158
- #define TU_BSWAP16 (u16 ) (__builtin_bswap16(u16 ))
159
- #define TU_BSWAP32 (u32 ) (__builtin_bswap32(u32 ))
158
+ // Unfortunately XC16 doesn't provide builtins for 32bit endian conversion
159
+ #if defined(__XC16)
160
+ #define TU_BSWAP16 (u16 ) (__builtin_swap(u16 ))
161
+ #define TU_BSWAP32 (u32 ) ((((u32 ) & 0xff000000 ) >> 24 ) | \
162
+ (((u32 ) & 0x00ff0000 ) >> 8 ) | \
163
+ (((u32 ) & 0x0000ff00 ) << 8 ) | \
164
+ (((u32 ) & 0x000000ff ) << 24 ))
165
+ #else
166
+ #define TU_BSWAP16 (u16 ) (__builtin_bswap16(u16 ))
167
+ #define TU_BSWAP32 (u32 ) (__builtin_bswap32(u32 ))
168
+ #endif
160
169
161
170
#ifndef __ARMCC_VERSION
162
171
// List of obsolete callback function that is renamed and should not be defined.
You can’t perform that action at this time.
0 commit comments