5#ifndef LIBSPADES_DATATYPES_H
6#define LIBSPADES_DATATYPES_H
25#define isnan(x) (x != x)
27#define isnotnan(x) (x == x)
29#define isinf(x) ((x > FLT_MAX) || (x < -FLT_MAX))
31#define isnotinf(x) ((x < FLT_MAX) && (x > -FLT_MAX))
33#define isfinite(x) (isnotnan(x) && isnotinf(x))
35#define isnotfinite(x) (isnan(x) || isinf(x))
37#if defined(__STRICT_ANSI__) || !defined(__STDC_VERSION__)
39#define fabsf(x) ((float)fabs((double)(x)))
40#define fmodf(x, y) ((float)fmod((double)(x), (double)(y)))
41#define sqrtf(x) ((float)sqrt((double)(x)))
42#define floorf(x) ((float)floor((double)(x)))
43#define ceilf(x) ((float)ceil((double)(x)))
44#define truncf(x) ((x) > 0 ? floorf(x) : ceilf(x))
48#if (defined(__has_include) && !defined(STDINT_INCLUDED))
49#if (__has_include(<stdint.h>))
51#define STDINT_INCLUDED
54#ifndef STDINT_INCLUDED
60#define STDINT_INCLUDED
63typedef unsigned char uint8_t;
66typedef signed char int8_t;
69#if (USHRT_MAX == 65535)
70typedef unsigned short uint16_t;
71#elif (UINT_MAX == 65535)
72typedef unsigned int uint16_t;
76#if (SHRT_MAX == 32767)
77typedef signed short int16_t;
78#elif (INT_MAX == 32767)
79typedef signed int int16_t;
83#if (USHRT_MAX == 4294967295)
84typedef unsigned short uint32_t;
85#elif (UINT_MAX == 4294967295)
86typedef unsigned int uint32_t;
87#elif (ULONG_MAX == 4294967295)
88typedef unsigned long uint32_t;
92#if (SHRT_MAX == 2147483647)
93typedef signed short int32_t;
94#elif (INT_MAX == 2147483647)
95typedef signed int int32_t;
96#elif (LONG_MAX == 2147483647)
97typedef signed long int32_t;
101typedef uint8_t uint_fast8_t;
102typedef uint32_t uint_fast16_t;
103typedef uint32_t uint_fast32_t;
104typedef int8_t int_fast8_t;
105typedef int32_t int_fast16_t;
106typedef int32_t int_fast32_t;
111#if (MAX_PLAYERS == 256)
112#include <immintrin.h>
113typedef __m256 bitmask_t;
114#elif (MAX_PLAYERS == 128)
115typedef __uint128_t bitmask_t;
116#elif (MAX_PLAYERS == 64)
117typedef uint_fast64_t bitmask_t;
118#elif (MAX_PLAYERS == 32)
119typedef uint_fast32_t bitmask_t;
120#elif (MAX_PLAYERS == 16)
121typedef uint_fast16_t bitmask_t;
122#elif (MAX_PLAYERS == 8)
123typedef uint_fast8_t bitmask_t;
124#elif !defined(MAX_PLAYERS)
125#define MAX_PLAYERS 32
126typedef uint_fast32_t bitmask_t;
128#error MAX_PLAYERS must be a power of 2 from 8 to 256!
136typedef float Vector3Float[3];
139typedef int8_t Vector3Sint8[3];
141typedef uint8_t Vector3Uint8[3];
143typedef uint8_t Vector4Uint8[4];
146typedef int32_t Vector3Sint32[3];
148typedef uint32_t Vector3Uint32[3];
151typedef int64_t Vector3Sint64[3];
153typedef uint64_t Vector3Uint64[3];
156typedef float Vector2Float[2];
159typedef uint_fast8_t bool;