Even more conversion, lots of superfluous macro removal

This commit is contained in:
iikorni
2026-08-29 23:14:23 -05:00
parent 70e5c02355
commit de75b014b3
102 changed files with 7060 additions and 8179 deletions
+6 -42
View File
@@ -75,16 +75,6 @@
#endif
#endif
#define q_maxCHAR ((char)0x7f)
#define q_maxSHORT ((short)0x7fff)
#define q_maxINT ((int)0x7fffffff)
#define q_maxLONG ((int)0x7fffffff)
#define q_minCHAR ((char)0x80)
#define q_minSHORT ((short)0x8000)
#define q_minINT ((int)0x80000000)
#define q_minLONG ((int)0x80000000)
#ifndef COMPILE_TIME_ASSERT
#if defined(__cplusplus)
/* Keep C++ case alone: Some versions of gcc will define __STDC_VERSION__ even when compiling in C++ mode. */
@@ -97,28 +87,21 @@
#define COMPILE_TIME_ASSERT(name, x) _Static_assert(x, #x)
#endif
#endif /**/
#ifndef COMPILE_TIME_ASSERT
/* universal, but may trigger -Wunused-local-typedefs */
#define COMPILE_TIME_ASSERT(name, x) \
typedef int dummy_ ## name[(x) * 2 - 1]
#endif
COMPILE_TIME_ASSERT(char, sizeof(char) == 1);
COMPILE_TIME_ASSERT(float, sizeof(float) == 4);
COMPILE_TIME_ASSERT(long, sizeof(long) >= 4);
COMPILE_TIME_ASSERT(int, sizeof(int) == 4);
COMPILE_TIME_ASSERT(short, sizeof(short) == 2);
static_assert(sizeof(char) == 1);
static_assert(sizeof(float) == 4);
static_assert(sizeof(long) >= 4);
static_assert(sizeof(int) == 4);
static_assert(sizeof(short) == 2);
/* make sure enums are the size of ints for structure packing */
typedef enum {
THE_DUMMY_VALUE
} THE_DUMMY_ENUM;
COMPILE_TIME_ASSERT(enum, sizeof(THE_DUMMY_ENUM) == sizeof(int));
static_assert(sizeof(THE_DUMMY_ENUM) == sizeof(int));
/* for array size: */
#define Q_COUNTOF(x) (sizeof(x) / sizeof((x)[0]))
/* Provide a substitute for offsetof() if we don't have one.
* This variant works on most (but not *all*) systems...
*/
@@ -131,25 +114,6 @@ COMPILE_TIME_ASSERT(enum, sizeof(THE_DUMMY_ENUM) == sizeof(int));
typedef unsigned char byte;
/* some structures have qboolean members and the x86 asm code expect
* those members to be 4 bytes long. i.e.: qboolean must be 32 bits. */
typedef int qboolean;
#undef true
#undef false
#if !defined(__cplusplus)
#if defined __STDC_VERSION__ && (__STDC_VERSION__ >= 199901L)
#include <stdbool.h>
#else
enum {
false = 0,
true = 1
};
#endif
#endif /* */
COMPILE_TIME_ASSERT(falsehood, ((1 != 1) == false));
COMPILE_TIME_ASSERT(truth, ((1 == 1) == true));
COMPILE_TIME_ASSERT(qboolean, sizeof(qboolean) == 4);
/*==========================================================================*/
/* math */