File tree Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Expand file tree Collapse file tree 1 file changed +18
-5
lines changed Original file line number Diff line number Diff line change 138
138
#define TU_ATTR_BIT_FIELD_ORDER_BEGIN
139
139
#define TU_ATTR_BIT_FIELD_ORDER_END
140
140
141
- #if __has_attribute(__fallthrough__)
142
- #define TU_ATTR_FALLTHROUGH __attribute__ ((fallthrough))
143
- #else
141
+ #if __GNUC__ < 5
144
142
#define TU_ATTR_FALLTHROUGH do {} while (0 ) /* fallthrough */
143
+ #else
144
+ #if __has_attribute(__fallthrough__)
145
+ #define TU_ATTR_FALLTHROUGH __attribute__ ((fallthrough))
146
+ #else
147
+ #define TU_ATTR_FALLTHROUGH do {} while (0 ) /* fallthrough */
148
+ #endif
145
149
#endif
146
150
147
151
// Endian conversion use well-known host to network (big endian) naming
151
155
#define TU_BYTE_ORDER TU_BIG_ENDIAN
152
156
#endif
153
157
154
- #define TU_BSWAP16 (u16 ) (__builtin_bswap16(u16 ))
155
- #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
156
169
157
170
#ifndef __ARMCC_VERSION
158
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