SDL_min(3)
π NAME π
SDL_min β bestie, it literally just returns the lesser of two values. that's it. that's the whole girl. β¨
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
#define SDL_min(x, y) (((x) < (y)) ? (x) : (y))
okay so it's a macro, not a function, which is so important, do not skip that part. π
π DESCRIPTION π
This is a lil helper macro that might be more clear than writing out the comparisons directly, and it works with any type that can be compared with the < operator. versatile queen. π
β οΈ BUT. listen. it <b>double-evaluates both of its parameters</b>, so do <b>NOT</b> use expressions with side-effects here. i'm so serious, bestie, not the side effects. ππ
π¦ MACRO PARAMETERS π¦
xβ the first value to compare. the one on the left. the og. π«Άyβ the second value to compare. the one on the right, hoping it's smaller. π
β¨ RETURN VALUE β¨
Returns the lesser of x and y. whichever one is more lowkey, basically. no cap. π
π₯ THREAD SAFETY π₯
It is safe to call this macro from any thread. π main character energy across all your threads, fr fr.
β AVAILABILITY β
This macro is available since SDL 3.2.0. vintage but make it iconic. π
that's the whole page, you ate it, mwah πβ¨
brought to you by the Simple Directmedia Layer girlies, SDL 3.4.18, SDL_min(3) β ily, go compare some values responsibly ππ¦π
π¦ where this page comes from
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 43: SDL3-devel 3.4.18-1.fc43 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- fedora 44: SDL3-devel 3.4.18-1.fc44 Β· Zlib AND MIT AND Apache-2.0 AND (Apache-2.0 OR MIT)
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms