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