1al_fixmul(3) Library Functions Manual al_fixmul(3)
2
3
4
6 al_fixmul
7
9 #include <allegro5/allegro.h>
10
11 al_fixed al_fixmul(al_fixed x, al_fixed y);
12
14 A fixed point value can be multiplied or divided by an integer with the
15 normal * and / operators. To multiply two fixed point values, though,
16 you must use this function.
17
18 If an overflow occurs, Allegro's errno will be set and the maximum pos‐
19 sible value will be returned, but errno is not cleared if the operation
20 is successful. This means that if you are going to test for overflow
21 you should call al_set_errno(0) before calling al_fixmul(3).
22
23 Example:
24
25 al_fixed result;
26
27 /* This will put 30000 into `result'. */
28 result = al_fixmul(al_itofix(10), al_itofix(3000));
29
30 /* But this overflows, and sets errno. */
31 result = al_fixmul(al_itofix(100), al_itofix(3000));
32 assert(!al_get_errno());
33
35 Returns the clamped result of multiplying x by y, setting Allegro's
36 errno to ERANGE if there was an overflow.
37
39 al_fixadd(3), al_fixsub(3), al_fixdiv(3), al_get_errno(3).
40
41
42
43Allegro reference manual al_fixmul(3)