TurboPFor: Config/Platform
This commit is contained in:
@ -36,6 +36,8 @@ typedef unsigned long long uint64_t;
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#endif
|
#endif
|
||||||
#include <stddef.h>
|
#include <stddef.h>
|
||||||
|
#define __STDC_WANT_IEC_60559_TYPES_EXT__
|
||||||
|
#include <float.h>
|
||||||
|
|
||||||
//------------------------- Compiler ------------------------------------------
|
//------------------------- Compiler ------------------------------------------
|
||||||
#if defined(__GNUC__)
|
#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 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 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; }
|
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; }
|
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 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; }
|
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 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 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)); }
|
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)); }
|
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 stof32( void *cp, float x) { memcpy(cp, &x, sizeof(x)); }
|
||||||
static ALWAYS_INLINE void stof64( void *cp, double 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 shortu { unsigned short s; };
|
||||||
struct _PACKED unsignedu { unsigned u; };
|
struct _PACKED unsignedu { unsigned u; };
|
||||||
struct _PACKED longu { uint64_t l; };
|
struct _PACKED longu { uint64_t l; };
|
||||||
|
#ifdef FLT16_MAX
|
||||||
struct _PACKED float16u { _Float16 g; };
|
struct _PACKED float16u { _Float16 g; };
|
||||||
|
#endif
|
||||||
struct _PACKED floatu { float f; };
|
struct _PACKED floatu { float f; };
|
||||||
struct _PACKED doubleu { double d; };
|
struct _PACKED doubleu { double d; };
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user