2006-04-13 20:47:06 +00:00
|
|
|
// Compatibility declarations for things which might not be present in
|
|
|
|
// certain build environments. It also levels the playing field caused
|
|
|
|
// by different platforms.
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef compat_h_
|
|
|
|
#define compat_h_
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2017-02-25 08:15:16 +00:00
|
|
|
#pragma once
|
|
|
|
|
2020-01-25 10:56:13 +00:00
|
|
|
#include "xs_Float.h"
|
2020-04-11 21:46:42 +00:00
|
|
|
#include "m_alloc.h"
|
2020-06-20 16:17:49 +00:00
|
|
|
#include "intvec.h"
|
2020-08-30 21:34:40 +00:00
|
|
|
#include "m_swap.h"
|
2020-01-25 10:56:13 +00:00
|
|
|
|
2017-02-25 08:15:16 +00:00
|
|
|
////////// Language and compiler feature polyfills //////////
|
|
|
|
|
2017-09-23 03:17:29 +00:00
|
|
|
# define fallthrough__ [[fallthrough]]
|
2012-03-18 08:50:41 +00:00
|
|
|
|
2017-02-25 08:15:16 +00:00
|
|
|
////////// Architecture detection //////////
|
|
|
|
|
2020-08-30 21:34:40 +00:00
|
|
|
#ifdef WORDS_BIGENDIAN
|
2006-04-13 20:47:06 +00:00
|
|
|
# define B_BIG_ENDIAN 1
|
2020-08-30 21:34:40 +00:00
|
|
|
#else
|
2006-04-13 20:47:06 +00:00
|
|
|
# define B_BIG_ENDIAN 0
|
|
|
|
#endif
|
|
|
|
|
2019-04-18 17:24:22 +00:00
|
|
|
#include <inttypes.h>
|
|
|
|
#include <stdint.h>
|
2006-08-31 01:54:23 +00:00
|
|
|
|
2017-02-25 08:15:36 +00:00
|
|
|
#include <limits.h>
|
2017-02-25 08:15:16 +00:00
|
|
|
#include <stdarg.h>
|
2018-11-18 18:09:48 +00:00
|
|
|
#include <stddef.h>
|
2017-02-25 08:15:16 +00:00
|
|
|
#include <stdio.h>
|
2018-11-18 18:09:48 +00:00
|
|
|
#include <stdlib.h>
|
2017-02-25 08:15:16 +00:00
|
|
|
#include <string.h>
|
2006-08-31 01:54:23 +00:00
|
|
|
|
2019-07-16 09:35:09 +00:00
|
|
|
#if !(defined _WIN32 && defined __clang__)
|
2017-02-25 08:15:36 +00:00
|
|
|
#include <float.h>
|
2019-07-16 09:35:09 +00:00
|
|
|
#endif
|
2018-11-18 18:09:48 +00:00
|
|
|
#include <math.h>
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2017-02-25 08:15:16 +00:00
|
|
|
#include <ctype.h>
|
|
|
|
#include <errno.h>
|
2018-11-18 18:09:48 +00:00
|
|
|
#include <time.h>
|
2015-05-03 07:03:12 +00:00
|
|
|
|
2017-02-25 08:15:16 +00:00
|
|
|
#include <assert.h>
|
2015-05-03 07:03:48 +00:00
|
|
|
|
2019-07-16 09:35:09 +00:00
|
|
|
# include <limits>
|
2018-10-16 06:09:54 +00:00
|
|
|
# include <algorithm>
|
|
|
|
# include <functional>
|
2017-04-12 08:30:29 +00:00
|
|
|
# include <type_traits>
|
2017-02-25 08:15:16 +00:00
|
|
|
|
|
|
|
////////// Platform headers //////////
|
|
|
|
|
2020-04-11 21:50:43 +00:00
|
|
|
#include "engineerrors.h"
|
2017-02-25 08:15:16 +00:00
|
|
|
|
2021-03-24 20:13:36 +00:00
|
|
|
typedef intptr_t bssize_t;
|
2017-02-25 08:15:16 +00:00
|
|
|
|
|
|
|
#define BMAX_PATH 256
|
|
|
|
|
2017-04-12 08:30:29 +00:00
|
|
|
////////// Metaprogramming structs //////////
|
|
|
|
|
2020-08-30 21:34:40 +00:00
|
|
|
using native_t = intptr_t;
|
2017-04-12 08:30:32 +00:00
|
|
|
|
2014-12-27 18:36:43 +00:00
|
|
|
typedef struct {
|
|
|
|
float x, y;
|
|
|
|
} vec2f_t;
|
|
|
|
|
|
|
|
typedef struct {
|
2019-07-24 01:38:05 +00:00
|
|
|
union {
|
|
|
|
struct {
|
|
|
|
union { float x, d; };
|
|
|
|
union { float y, u; };
|
|
|
|
union { float z, v; };
|
|
|
|
};
|
|
|
|
vec2f_t vec2;
|
|
|
|
};
|
2014-12-27 18:36:43 +00:00
|
|
|
} vec3f_t;
|
|
|
|
|
2020-09-04 19:24:48 +00:00
|
|
|
static_assert(sizeof(vec3f_t) == sizeof(float) * 3);
|
2015-03-24 00:40:33 +00:00
|
|
|
|
2017-02-25 08:16:01 +00:00
|
|
|
|
2019-12-29 15:35:51 +00:00
|
|
|
#include "basics.h"
|
|
|
|
|
2019-05-19 03:52:54 +00:00
|
|
|
////////// Bitfield manipulation //////////
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#endif // compat_h_
|