Skip site navigation (1)Skip section navigation (2)

FreeBSD Manual Pages

  
 
  

home | help
al_fixmul(3)		   Library Functions Manual		  al_fixmul(3)

NAME
       al_fixmul - Allegro 5 API

SYNOPSIS
	      #include <allegro5/allegro.h>

	      al_fixed al_fixmul(al_fixed x, al_fixed y);

DESCRIPTION
       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, Allegro's	errno will be set and the maximum pos-
       sible 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 call al_set_errno(0) before calling al_fixmul(3).

       Example:

	      al_fixed result;

	      /* This will put 30000 into `result'. */
	      result = al_fixmul(al_itofix(10),	al_itofix(3000));

	      /* But this overflows, and sets errno. */
	      result = al_fixmul(al_itofix(100), al_itofix(3000));
	      assert(!al_get_errno());

RETURN VALUE
       Returns the clamped result of multiplying x by y, setting Allegro's er-
       rno to ERANGE if	there was an overflow.

SEE ALSO
       al_fixadd(3), al_fixsub(3), al_fixdiv(3), al_get_errno(3).

Allegro	reference manual					  al_fixmul(3)

Want to link to this manual page? Use this URL:
<https://man.freebsd.org/cgi/man.cgi?query=al_fixmul&sektion=3&manpath=FreeBSD+Ports+14.3.quarterly>

home | help