From 01d137592cf47863176638ade668ef6a218c3053 Mon Sep 17 00:00:00 2001 From: Sam Lantinga Date: Tue, 22 Nov 2022 07:56:43 -0800 Subject: [PATCH] Updated SDL_VERSIONNUM macro for new SDL version convention Fixes https://github.com/libsdl-org/SDL/issues/6578 --- include/SDL_version.h | 26 ++++---------------------- 1 file changed, 4 insertions(+), 22 deletions(-) diff --git a/include/SDL_version.h b/include/SDL_version.h index 75cc89149..6b6c59ba2 100644 --- a/include/SDL_version.h +++ b/include/SDL_version.h @@ -83,44 +83,26 @@ typedef struct SDL_version (x)->patch = SDL_PATCHLEVEL; \ } -/* TODO: Remove this whole block in SDL 3 */ -#if SDL_MAJOR_VERSION <= 3 /** * This macro turns the version numbers into a numeric value: * \verbatim - (1,2,3) -> (1203) + (1,2,3) -> (0x1000203) \endverbatim - * - * This assumes that there will never be more than 100 patchlevels. - * - * In versions higher than 2.9.0, the minor version overflows into - * the thousands digit: for example, 2.23.0 is encoded as 4300, - * and 2.255.99 would be encoded as 25799. - * This macro will not be available in SDL 3.x. */ -#define SDL_VERSIONNUM(X, Y, Z) \ - ((X)*1000 + (Y)*100 + (Z)) +#define SDL_VERSIONNUM(X, Y, Z) \ + ((X) << 24 | (Y) << 8 | (Z) << 0) /** * This is the version number macro for the current SDL version. - * - * In versions higher than 2.9.0, the minor version overflows into - * the thousands digit: for example, 2.23.0 is encoded as 4300. - * This macro will not be available in SDL 3.x. - * - * Deprecated, use SDL_VERSION_ATLEAST or SDL_VERSION instead. */ #define SDL_COMPILEDVERSION \ SDL_VERSIONNUM(SDL_MAJOR_VERSION, SDL_MINOR_VERSION, SDL_PATCHLEVEL) -#endif /* SDL_MAJOR_VERSION < 3 */ /** * This macro will evaluate to true if compiled with SDL at least X.Y.Z. */ #define SDL_VERSION_ATLEAST(X, Y, Z) \ - ((SDL_MAJOR_VERSION >= X) && \ - (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION >= Y) && \ - (SDL_MAJOR_VERSION > X || SDL_MINOR_VERSION > Y || SDL_PATCHLEVEL >= Z)) + (SDL_COMPILEDVERSION >= SDL_VERSIONUM(X, Y, Z)) /** * Get the version of SDL that is linked against your program.