This commit is contained in:
alessandro bason 2025-06-24 17:47:08 +02:00
parent 95d74c2ef4
commit a66e58193f
25 changed files with 2600 additions and 93 deletions

42
core.h
View file

@ -20,21 +20,6 @@ void colla_cleanup(void);
/////////////////////////////////////////////////
// USEFUL MACROS ////////////////////////////////
#define arrlen(a) (sizeof(a) / sizeof((a)[0]))
#define COLLA_UNUSED(v) (void)(v)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define KB(n) (((u64)n) << 10)
#define MB(n) (((u64)n) << 20)
#define GB(n) (((u64)n) << 30)
#define TB(n) (((u64)n) << 40)
/////////////////////////////////////////////////
// LINKED LISTS /////////////////////////////////
// singly linked list
@ -73,7 +58,7 @@ void colla_cleanup(void);
// OS AND COMPILER MACROS ///////////////////////
#if defined(_DEBUG) || !defined(NDEBUG)
#if defined(_DEBUG)
#define COLLA_DEBUG 1
#define COLLA_RELEASE 0
#else
@ -163,6 +148,31 @@ void colla_cleanup(void);
/////////////////////////////////////////////////
// USEFUL MACROS ////////////////////////////////
#define arrlen(a) (sizeof(a) / sizeof((a)[0]))
#define COLLA_UNUSED(v) (void)(v)
#define COLLA__STRINGIFY(x) #x
#define COLLA_STRINGIFY(x) COLLA__STRINGIFY(x)
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define MAX(a, b) ((a) > (b) ? (a) : (b))
#define KB(n) (((u64)n) << 10)
#define MB(n) (((u64)n) << 20)
#define GB(n) (((u64)n) << 30)
#define TB(n) (((u64)n) << 40)
#if COLLA_DEBUG
#define colla__assert(file, line, cond, ...) do { if (!(cond)) fatal(file ":" line " ASSERT FAILED: (" COLLA__STRINGIFY(cond) ") " __VA_ARGS__); } while (0)
#define colla_assert(...) colla__assert(__FILE__, COLLA__STRINGIFY(__LINE__), __VA_ARGS__)
#else
#define colla_assert(...) (void)0
#endif
/////////////////////////////////////////////////
// BASIC TYPES //////////////////////////////////
#if COLLA_WIN && COLLA_UNICODE