1fixmul(3) Allegro manual fixmul(3)
2
3
4
6 fixmul - Multiplies two fixed point values together. Allegro game pro‐
7 gramming library.
8
10 #include <allegro.h>
11
12
13 fixed fixmul(fixed x, fixed y);
14
16 A fixed point value can be multiplied or divided by an integer with the
17 normal `*' and `/' operators. To multiply two fixed point values,
18 though, you must use this function.
19
20 If an overflow occurs, `errno' will be set and the maximum possible
21 value will be returned, but `errno' is not cleared if the operation is
22 successful. This means that if you are going to test for overflow you
23 should set `errno=0' before calling fixmul(). Example:
24
25 fixed result;
26
27 /* This will put 30000 into `result'. */
28 result = fixmul(itofix(10), itofix(3000));
29 /* But this overflows, and sets `errno'. */
30 result = fixmul(itofix(100), itofix(3000));
31 ASSERT(!errno);
32
34 Returns the clamped result of multiplying `x' by `y', setting `errno'
35 to ERANGE if there was an overflow.
36
37
39 fixadd(3), fixsub(3), fixdiv(3), ex3buf(3), excustom(3), exfixed(3),
40 exspline(3), exstars(3), exupdate(3)
41
42
43
44Allegro version 4.2.2 fixmul(3)