Re: [AD] Borland C++ compilation errors

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


> True, I wonder whether it's worth fixing.

IMHO it is and I propose to add a ffloor() function similar to the ANSI C
floor().

> I can't think of anything more efficient than testing the sign of the
> number:
>
>     if (x >= 0)
>         return (x >> 16);
>     else
>         return -(-x >> 16);

Except that it doesn't work for most negative numbers :-)

int ffloor(fixed x)
{
   if (x >= 0)
      return (x >> 16);
   else
      return ~((~x) >> 16);
}

is better.

--
Eric Botcazou
ebotcazou@xxxxxxxxxx



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/