SDL_size_mul_check_overflow(3)
π SDL_size_mul_check_overflow(3) π
okay bestie, so this is a page from the SDL3 FUNCTIONS manual and it's literally about one of the most underrated little functions ever β multiplying two numbers without letting your math silently explode. slay. π
β¨ NAME β¨
SDL_size_mul_check_overflow β Multiply two integers, checking for overflow.
πΈ SYNOPSIS πΈ
#include <SDL3/SDL_stdinc.h>
SDL_FORCE_INLINE bool SDL_size_mul_check_overflow(size_t a, size_t b, size_t *ret);
π¦ DESCRIPTION π¦
so here's the vibe: if a * b would overflow, it returns false. that's it, that's the whole safety net π«Ά
otherwise, it stores a * b via ret and returns true. no cap, that's the entire deal.
π FUNCTION PARAMETERS π
aβ the multiplicand. (that's the first number getting multiplied, iykyk)bβ the multiplier. (the one doing the multiplying β¨)retβ on non-overflow output, stores the multiplication result, and it may not beNULL. like, do not passNULLhere, she will not be okay with that π
β RETURN VALUE β
Returns false on overflow, true if result is multiplied without overflow. main character binary energy, truly. π
π THREAD SAFETY π
It is safe to call this function from any thread. yes bestie, any thread, go wild, it's giving totally chill. π
π AVAILABILITY π
This function is available since SDL 3.2.0. so if you're on anything olderβ¦ it's not there, sorry babe π
and that's the whole page, you're officially a SDL_size_mul_check_overflow expert now π
β¨
this little cutie comes to you from Simple Directmedia Layer, rocking version SDL 3.4.18 β mwah, go multiply responsibly, bestie ππ¦π
π¦ 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