man itofix () - Converts an integer to fixed point. Allegro game programming library.

NAME

itofix - Converts an integer to fixed point. Allegro game programming library.

SYNOPSIS

#include <allegro.h>

fixed itofix(int x);

DESCRIPTION

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". Example:

   fixed number;
   /* This conversion is OK. */
   number = itofix(1);
   ASSERT(fixtoi(n) == 100);
   number = itofix(6);
   /* This check will fail in debug builds. */
   ASSERT(fixtoi(n) == 64000);

RETURN VALUE

Returns the value of the integer converted to fixed point ignoring overflows.

SEE ALSO