mirror of https://github.com/libsdl-org/SDL
Make SDL_VERSION_ATLEAST future-proof against larger version numbers
This comparison normally happens at compile-time, not at runtime, so it doesn't matter if it isn't optimal. This avoids incorrect comparison if the minor version in SDL_COMPILEDVERSION and SDL_VERSIONNUM has more than one digit, which would cause it to overflow from the hundreds place into the thousands place. Signed-off-by: Simon McVittie <smcv@collabora.com>
This commit is contained in:
parent
50bc013695
commit
f9a5cf77b8
|
@ -104,7 +104,9 @@ typedef struct SDL_version
|
|||
* This macro will evaluate to true if compiled with SDL at least X.Y.Z.
|
||||
*/
|
||||
#define SDL_VERSION_ATLEAST(X, Y, Z) \
|
||||
(SDL_COMPILEDVERSION >= SDL_VERSIONNUM(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))
|
||||
|
||||
/**
|
||||
* Get the version of SDL that is linked against your program.
|
||||
|
|
Loading…
Reference in New Issue