itofix(3alleg)

itofix3alleg

Converts an integer to fixed point. allegro game programming library.

Usage

#include <allegro.h>

fixed itofix(int x);

Overview

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(100);
   ASSERT(fixtoi(number) == 100);
   number = itofix(64000);
   /* This check will fail in debug builds. */
   ASSERT(fixtoi(number) == 64000);

Return value

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

Releases

4 releases since Debian 3.1 (Sarge); the text changed 2 times.

  1. 3.1
  2. 4.0
  3. 5.0–6.0

From liballegro-doc 2:4.2.2-2.2 in Debian 6.0 (Squeeze). Parsed by carta from the page's man source.