mirror of
https://github.com/mkxp-z/mkxp-z.git
synced 2025-08-23 15:23:44 +02:00
Improve determination of size of stbsp__uintptr
in stb_sprintf
This commit is contained in:
parent
917c3d735f
commit
9da4fc8540
2 changed files with 15 additions and 12 deletions
10
meson.build
10
meson.build
|
@ -45,6 +45,12 @@ endif
|
||||||
sizeof = {'void*': compilers['cpp'].sizeof('void*'),
|
sizeof = {'void*': compilers['cpp'].sizeof('void*'),
|
||||||
'long': compilers['cpp'].sizeof('long')
|
'long': compilers['cpp'].sizeof('long')
|
||||||
}
|
}
|
||||||
|
if sizeof['void*'] <= 0
|
||||||
|
error('Failed to detect size of void*')
|
||||||
|
endif
|
||||||
|
if sizeof['long'] <= 0
|
||||||
|
error('Failed to detect size of long')
|
||||||
|
endif
|
||||||
win64 = (sizeof['void*'] != sizeof['long'])
|
win64 = (sizeof['void*'] != sizeof['long'])
|
||||||
android_api_level = host_system == 'android' ? compilers['c'].get_define('__ANDROID_API__').to_int() : 0
|
android_api_level = host_system == 'android' ? compilers['c'].get_define('__ANDROID_API__').to_int() : 0
|
||||||
|
|
||||||
|
@ -71,6 +77,10 @@ else
|
||||||
global_args += '-DHAVE_NANOSLEEP'
|
global_args += '-DHAVE_NANOSLEEP'
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
if sizeof['void*'] <= 4
|
||||||
|
global_args += '-DMKXPZ_32_BIT_POINTER'
|
||||||
|
endif
|
||||||
|
|
||||||
if (get_option('libretro_force_fat_lto') or (core_is_static and not is_emscripten)) and get_option('b_lto')
|
if (get_option('libretro_force_fat_lto') or (core_is_static and not is_emscripten)) and get_option('b_lto')
|
||||||
global_args += '-ffat-lto-objects'
|
global_args += '-ffat-lto-objects'
|
||||||
endif
|
endif
|
||||||
|
|
|
@ -1,20 +1,13 @@
|
||||||
# Forces `stbsp__uintptr` to be a 64-bit unsigned integer on every platform.
|
# Changes the type of `stbsp__uintptr` to use Meson's detection of 32-bit platforms instead of hardcoding based on preprocessor defines.
|
||||||
|
|
||||||
--- a/stb_sprintf.h
|
--- a/stb_sprintf.h
|
||||||
+++ b/stb_sprintf.h
|
+++ b/stb_sprintf.h
|
||||||
@@ -230,11 +230,11 @@ STBSP__PUBLICDEC void STB_SPRINTF_DECORATE(set_separators)(char comma, char peri
|
@@ -230,7 +230,7 @@ STBSP__PUBLICDEC void STB_SPRINTF_DECORATE(set_separators)(char comma, char peri
|
||||||
#define stbsp__uint16 unsigned short
|
#define stbsp__uint16 unsigned short
|
||||||
|
|
||||||
#ifndef stbsp__uintptr
|
#ifndef stbsp__uintptr
|
||||||
-#if defined(__ppc64__) || defined(__powerpc64__) || defined(__aarch64__) || defined(_M_X64) || defined(__x86_64__) || defined(__x86_64) || defined(__s390x__)
|
-#if defined(__ppc64__) || defined(__powerpc64__) || defined(__aarch64__) || defined(_M_X64) || defined(__x86_64__) || defined(__x86_64) || defined(__s390x__)
|
||||||
+
|
+#ifndef MKXPZ_32_BIT_POINTER
|
||||||
#define stbsp__uintptr stbsp__uint64
|
#define stbsp__uintptr stbsp__uint64
|
||||||
-#else
|
#else
|
||||||
-#define stbsp__uintptr stbsp__uint32
|
#define stbsp__uintptr stbsp__uint32
|
||||||
-#endif
|
|
||||||
+
|
|
||||||
+
|
|
||||||
+
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef STB_SPRINTF_MSVC_MODE // used for MSVC2013 and earlier (MSVC2015 matches GCC)
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue