umult32(3)
β¨ NAME β¨
umult32 β integer multiplication with overflow checking π
okay so bestie, this is the safe multiply girlie. she multiplies two unsigned 32-bit numbers and tells you if it went sideways instead of just silently lying to your face. no cap, that's the whole vibe.
π SYNTAX π
#include <libowfat/safemult.h>
int umult32(uint32 a,uint32 b,uint32* c);
yes you do need that include, don't skip it, the compiler will absolutely humble you πΈ
π DESCRIPTION π
so here's the tea, bestie. umult32 does
c = a*b
and returns 1. that's it. that's the girl. she ate. β¨
but β and this is the important part, the part where she becomes your main character β if there's an integer overflow, she does not touch c at all. she leaves it exactly the way she found it, and returns 0. π«Ά
so if you get a0back, yourcis untouched and your math was a lie. respect the return value or perish π
like, c stays alone on overflow. untouched. unbothered. not a single byte changed. she's just telling you "bestie this did not fit, i'm not doing it." π
π₯ SEE ALSO π₯
the whole safemult friend group, they all serve π¦
k bye ily, this was the <code>umult32(3)</code> page from the Library Functions Manual β stay safe out there and always check your return values π
π¦ where this page comes from
- alpine 3.24: libowfat-doc 0.34-r0 Β· GPL-2.0-only
- debian bookworm: libowfat-dev 0.32-4 Β· GPL-2.0-only
- debian trixie: libowfat-dev 0.32-5 Β· GPL-2.0-only
- nixos 26.05: libowfat 0.34
- nixpkgs unstable: libowfat 0.34
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- opensuse-leap 16.0: libowfat-devel 0.33-bp160.1.11 Β· GPL-2.0-only
- ubuntu noble: libowfat-dev 0.32-4.1build1 Β· GPL-2.0-only
- ubuntu questing: libowfat-dev 0.32-5
- ubuntu resolute: libowfat-dev 0.34-2 Β· GPL-2.0-only
- ubuntu stonking: libowfat-dev 0.34-2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms