1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44
|
.TH "al_itofix" "3" "" "Allegro reference manual" ""
.SH NAME
.PP
al_itofix \- Allegro 5 API
.SH SYNOPSIS
.IP
.nf
\f[C]
#include\ <allegro5/allegro.h>
al_fixed\ al_itofix(int\ x);
\f[]
.fi
.SH DESCRIPTION
.PP
Converts an integer to fixed point.
This is the same thing as x<<16.
Remember that overflows (trying to convert an integer greater than
32767) and underflows (trying to convert an integer lesser than \-32768)
are not detected even in debug builds! The values simply "wrap around".
.PP
Example:
.IP
.nf
\f[C]
al_fixed\ number;
/*\ This\ conversion\ is\ OK.\ */
number\ =\ al_itofix(100);
assert(al_fixtoi(number)\ ==\ 100);
number\ =\ al_itofix(64000);
/*\ This\ check\ will\ fail\ in\ debug\ builds.\ */
assert(al_fixtoi(number)\ ==\ 64000);
\f[]
.fi
.SH RETURN VALUE
.PP
Returns the value of the integer converted to fixed point ignoring
overflows.
.SH SEE ALSO
.PP
al_fixtoi(3), al_ftofix(3), al_fixtof(3).
|