###### (This is the documentation for SDL3, which is the current stable version. [SDL2](https://wiki.libsdl.org/SDL2/) was the previous version!) # SDL_min Return the lesser of two values. ## Header File Defined in [](https://github.com/libsdl-org/SDL/blob/main/include/SDL3/SDL_stdinc.h) ## Syntax ```c #define SDL_min(x, y) (((x) < (y)) ? (x) : (y)) ``` ## Macro Parameters | | | | ----- | ---------------------------- | | **x** | the first value to compare. | | **y** | the second value to compare. | ## Return Value Returns the lesser of `x` and `y`. ## Remarks This is a helper macro that might be more clear than writing out the comparisons directly, and works with any type that can be compared with the `<` operator. However, it double-evaluates both its parameters, so do not use expressions with side-effects here. ## Thread Safety It is safe to call this macro from any thread. ## Version This macro is available since SDL 3.1.3. ---- [CategoryAPI](CategoryAPI), [CategoryAPIMacro](CategoryAPIMacro), [CategoryStdinc](CategoryStdinc)