From 29e47ec1dc3208824db49eb663d26c19ff33dc54 Mon Sep 17 00:00:00 2001 From: x Date: Wed, 7 Jun 2023 13:33:03 +0200 Subject: [PATCH] TurboPFor: Config/Platform --- lib/include_/conf.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/include_/conf.h b/lib/include_/conf.h index 51b1c2e..397e93e 100644 --- a/lib/include_/conf.h +++ b/lib/include_/conf.h @@ -36,6 +36,8 @@ typedef unsigned long long uint64_t; #include #endif #include +#define __STDC_WANT_IEC_60559_TYPES_EXT__ +#include //------------------------- Compiler ------------------------------------------ #if defined(__GNUC__) @@ -169,7 +171,9 @@ static ALWAYS_INLINE unsigned short ctou16(const void *cp) { unsigned short static ALWAYS_INLINE unsigned ctou32(const void *cp) { unsigned x; memcpy(&x, cp, sizeof(x)); return x; } static ALWAYS_INLINE unsigned long long ctou64(const void *cp) { unsigned long long x; memcpy(&x, cp, sizeof(x)); return x; } static ALWAYS_INLINE size_t ctousz(const void *cp) { size_t x; memcpy(&x, cp, sizeof(x)); return x; } +#ifdef FLT16_MAX static ALWAYS_INLINE _Float16 ctof16(const void *cp) { _Float16 x; memcpy(&x, cp, sizeof(x)); return x; } +#endif static ALWAYS_INLINE float ctof32(const void *cp) { float x; memcpy(&x, cp, sizeof(x)); return x; } static ALWAYS_INLINE double ctof64(const void *cp) { double x; memcpy(&x, cp, sizeof(x)); return x; } @@ -177,7 +181,9 @@ static ALWAYS_INLINE void stou16( void *cp, unsigned short static ALWAYS_INLINE void stou32( void *cp, unsigned x) { memcpy(cp, &x, sizeof(x)); } static ALWAYS_INLINE void stou64( void *cp, unsigned long long x) { memcpy(cp, &x, sizeof(x)); } static ALWAYS_INLINE void stousz( void *cp, size_t x) { memcpy(cp, &x, sizeof(x)); } +#ifdef FLT16_MAX static ALWAYS_INLINE void stof16( void *cp, _Float16 x) { memcpy(cp, &x, sizeof(x)); } +#endif static ALWAYS_INLINE void stof32( void *cp, float x) { memcpy(cp, &x, sizeof(x)); } static ALWAYS_INLINE void stof64( void *cp, double x) { memcpy(cp, &x, sizeof(x)); } @@ -227,7 +233,9 @@ struct _PACKED doubleu { double d; }; struct _PACKED shortu { unsigned short s; }; struct _PACKED unsignedu { unsigned u; }; struct _PACKED longu { uint64_t l; }; +#ifdef FLT16_MAX struct _PACKED float16u { _Float16 g; }; +#endif struct _PACKED floatu { float f; }; struct _PACKED doubleu { double d; };