al_fixadd(3)
β¨ NAME β¨
okay so this is al_fixadd(3) from the Library Functions Manual, and itβs the Allegro 5 API entry for al_fixadd β bestie, thatβs the whole vibe π
.
π¦ SYNOPSIS π¦
#include <allegro5/allegro.h>
al_fixed al_fixadd(al_fixed x, al_fixed y);
π DESCRIPTION π
So like, fixed point numbers can totally be added with the normal + integer operator, but that gives you zero protection against overflow. No cap. If overflow is a problem for you, you should use this function instead. It is slower than using integer operators, but if an overflow occurs it will set Allegroβs errno and clamp the result, rather than just letting it wrap. Iconic behavior, honestly π«Ά.
Example:
al_fixed result;
/* This will put 5035 into `result'. */
result = al_fixadd(al_itofix(5000), al_itofix(35));
/* Sets errno and puts -32768 into `result'. */
result = al_fixadd(al_itofix(-31000), al_itofix(-3000));
assert(!al_get_errno()); /* This will fail. */
πΈ RETURN VALUE πΈ
Returns the clamped result of adding x to y, and sets Allegroβs errno to ERANGE if there was an overflow. Slay β¨.
π SEE ALSO π
And thatβs the whole page, bestie β source/version situation is the Allegro reference manual for al_fixadd(3), and the footer gives no date, so Iβm literally not inventing one, periodt π«Άπ.
π¦ where this page comes from
- arch rolling: allegro 5.2.11.3-2 Β· Zlib AND BSD-3-Clause AND OFL-1.1 AND LicenseRef-Custom
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms