Skip to content

Commit 29e47ec

Browse files
committed
TurboPFor: Config/Platform
1 parent 6dd6380 commit 29e47ec

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

lib/include_/conf.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ typedef unsigned long long uint64_t;
3636
#include <stdint.h>
3737
#endif
3838
#include <stddef.h>
39+
#define __STDC_WANT_IEC_60559_TYPES_EXT__
40+
#include <float.h>
3941

4042
//------------------------- Compiler ------------------------------------------
4143
#if defined(__GNUC__)
@@ -169,15 +171,19 @@ static ALWAYS_INLINE unsigned short ctou16(const void *cp) { unsigned short
169171
static ALWAYS_INLINE unsigned ctou32(const void *cp) { unsigned x; memcpy(&x, cp, sizeof(x)); return x; }
170172
static ALWAYS_INLINE unsigned long long ctou64(const void *cp) { unsigned long long x; memcpy(&x, cp, sizeof(x)); return x; }
171173
static ALWAYS_INLINE size_t ctousz(const void *cp) { size_t x; memcpy(&x, cp, sizeof(x)); return x; }
174+
#ifdef FLT16_MAX
172175
static ALWAYS_INLINE _Float16 ctof16(const void *cp) { _Float16 x; memcpy(&x, cp, sizeof(x)); return x; }
176+
#endif
173177
static ALWAYS_INLINE float ctof32(const void *cp) { float x; memcpy(&x, cp, sizeof(x)); return x; }
174178
static ALWAYS_INLINE double ctof64(const void *cp) { double x; memcpy(&x, cp, sizeof(x)); return x; }
175179

176180
static ALWAYS_INLINE void stou16( void *cp, unsigned short x) { memcpy(cp, &x, sizeof(x)); } // ua write
177181
static ALWAYS_INLINE void stou32( void *cp, unsigned x) { memcpy(cp, &x, sizeof(x)); }
178182
static ALWAYS_INLINE void stou64( void *cp, unsigned long long x) { memcpy(cp, &x, sizeof(x)); }
179183
static ALWAYS_INLINE void stousz( void *cp, size_t x) { memcpy(cp, &x, sizeof(x)); }
184+
#ifdef FLT16_MAX
180185
static ALWAYS_INLINE void stof16( void *cp, _Float16 x) { memcpy(cp, &x, sizeof(x)); }
186+
#endif
181187
static ALWAYS_INLINE void stof32( void *cp, float x) { memcpy(cp, &x, sizeof(x)); }
182188
static ALWAYS_INLINE void stof64( void *cp, double x) { memcpy(cp, &x, sizeof(x)); }
183189

@@ -227,7 +233,9 @@ struct _PACKED doubleu { double d; };
227233
struct _PACKED shortu { unsigned short s; };
228234
struct _PACKED unsignedu { unsigned u; };
229235
struct _PACKED longu { uint64_t l; };
236+
#ifdef FLT16_MAX
230237
struct _PACKED float16u { _Float16 g; };
238+
#endif
231239
struct _PACKED floatu { float f; };
232240
struct _PACKED doubleu { double d; };
233241

0 commit comments

Comments
 (0)