From 8dcbdc2d9a34640231d100b24fec8507854deb61 Mon Sep 17 00:00:00 2001 From: Ralph Engels Date: Mon, 18 Nov 2024 03:17:13 +0100 Subject: [PATCH] more forgotten changes... ALIGNTYPE16 --- neo/sys/platform.h | 106 ++++++++++++++++++++++----------------------- 1 file changed, 52 insertions(+), 54 deletions(-) diff --git a/neo/sys/platform.h b/neo/sys/platform.h index 567c83268..5bf306a14 100644 --- a/neo/sys/platform.h +++ b/neo/sys/platform.h @@ -38,11 +38,9 @@ If you have questions concerning this license or the applicable additional terms // NOTE: By default Win32 uses a 1MB stack. Doom3 1.3.1 uses 4MB (probably set after compiling with EDITBIN /STACK // dhewm3 now uses a 8MB stack, set with a linker flag in CMakeLists.txt (/STACK:8388608 for MSVC, -Wl,--stack,8388608 for mingw) -// Linux has a 8MB stack by default, and so does macOS, at least for the main thread. -// Anyway, a 1MB limit for _alloca() should be safe even when using it multiple times -// in the same function or callstack. -// If there's a risk of bigger stack allocations, Mem_MallocA() should be used instead. -#define ID_MAX_ALLOCA_SIZE 1048576 // 1MB +// Linux has a 8MB stack by default, and so does macOS, at least for the main thread +// anyway, a 2MB limit alloca should be safe even when using it multiple times in the same function +#define ID_MAX_ALLOCA_SIZE 2097152 // 2MB /* =============================================================================== @@ -56,16 +54,16 @@ If you have questions concerning this license or the applicable additional terms #if defined(__AROS__) #define _alloca alloca -#define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15)) +#define _alloca16( x ) ( ( void * )( ( ( ( uintptr_t )alloca( ( x ) + 15 ) ) + 15 ) & ~15 ) ) #ifdef GAME_DLL -#define ID_GAME_API __attribute__((visibility ("default"))) +#define ID_GAME_API __attribute__( ( visibility ( "default" ) ) ) #else #define ID_GAME_API #endif -#define ALIGN16( x ) x __attribute__ ((aligned (16))) -#define PACKED __attribute__((packed)) +#define ALIGN16( x ) x __attribute__ ( ( aligned ( 16 ) ) ) +#define PACKED __attribute__( ( packed ) ) #define PATHSEPERATOR_STR "/" #define PATHSEPERATOR_CHAR '/' @@ -84,13 +82,13 @@ If you have questions concerning this license or the applicable additional terms #if defined(WIN32) || defined(_WIN32) #ifdef __MINGW32__ - #undef _alloca // in mingw _alloca is a #define - // NOTE: Do *not* use __builtin_alloca_with_align(), unlike regular alloca it frees at end of block instead of end of function ! - #define _alloca16( x ) ( (void *) ( (assert((x) +// MSVC does not provide this C99 header +#include #endif #include #include @@ -275,7 +273,7 @@ typedef unsigned long ulong; typedef int qhandle_t; #ifndef NULL -#define NULL ((void *)0) +#define NULL ( ( void * ) 0 ) #endif #ifndef BIT