fixmul(3alleg)

fixmul3alleg

Multiplies two fixed point values together. allegro game programming library.

Usage

#include <allegro.h>

fixed fixmul(fixed x, fixed y);

Overview

A fixed point value can be multiplied or divided by an integer with the normal `*' and `/' operators. To multiply two fixed point values, though, you must use this function.

If an overflow occurs, `errno' will be set and the maximum possible value will be returned, but `errno' is not cleared if the operation is successful. This means that if you are going to test for overflow you should set `errno=0' before calling fixmul(). Example:

   fixed result;
   /* This will put 30000 into `result'. */
   result = fixmul(itofix(10), itofix(3000));
   /* But this overflows, and sets `errno'. */
   result = fixmul(itofix(100), itofix(3000));
   ASSERT(!errno);

Return value

Returns the clamped result of multiplying `x' by `y', setting `errno' to ERANGE if there was an overflow.

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.