Mail Archives: djgpp/1997/09/08/04:49:22
Nate Eldredge wrote:
>
> Does anybody know why the math functions aren't implemented as inline
> functions in the header file, but rather as regular functions? Since most of
> them are just one or two instructions, it seems that making them available
> as inline asm functions (like Allegro's _putpixel) would be much more
> efficient. For starters, it would avoid storing local floating-point
> variables from registers onto the stack, then reloading them within the
> function.
>
> At the very least, those to which it applies should have GCC's "const"
> attribute applied to them to let the compiler optimize better.
>
> If there's a disadvantage to this, somebody please let me know. Otherwise, I
> think it should be done.
About which functions are you thinking?
Most of them also do a ``normalizing'' step, because AFAIK
you cannot feed an arbitrary number to the NPU and execute
an fsin (e.g.) on it. Also, they do some kind of error
checking. I have to admit I never quite figured out for sure
which versions are usually called, though.
And what do you mean with the ``const'' attribute? All const
arguments are passed by value, so I cannot see where this
helps the optimizer? Or did I get something wrong?
--
Ciao
Tom
*************************************************************
* Thomas Demmer *
* Lehrstuhl fuer Stroemungsmechanik *
* Ruhr-Uni-Bochum *
* Universitaetsstr. 150 *
* D-44780 Bochum *
* Tel: +49 234 700 6434 *
* Fax: +49 234 709 4162 *
* http://www.lstm.ruhr-uni-bochum.de/~demmer *
*************************************************************
- Raw text -