al_itofix(3alleg5)

al_itofix3alleg5

Allegro 5 api

Usage

#include <allegro5/allegro.h>
al_fixed al_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:

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);

Return value

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

Releases

6 releases since Debian 8 (Jessie); the text changed 5 times.

  1. 8
  2. 9
  3. 10
  4. 11
  5. 12
  6. 13

From allegro5-doc 2:5.2.10.1+dfsg-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.