[AD] sincos() also found in BCC32 |
[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
I believe (if bcc32.txt is right) that BCC still cannot compile Allegro by
itself. So, I guess this is not really interesting for now, but might be
in the future. While digging rotate.c, I found this conditional (line 718):
#if (defined ALLEGRO_DJGPP) && (DJGPP >= 2) && (DJGPP_MINOR >= 3)
/* Faster way to obtain both sin and cos with one call under djgpp.
Todo: Do other platforms support this? (not watcom, mingw or msvc)
*/
sincos(&cos_angle, &sin_angle, angle * (M_PI / (double)0x800000));
#else
cos_angle = cos(angle * (M_PI / (double)0x800000));
sin_angle = sin(angle * (M_PI / (double)0x800000));
#endif
I had used the sincos() function also within BCC, which is declared at
fastmath.h (line 84):
void _FMAPI _fm_sincos(double __a, double *__x, double *__y);
and is defined with a macro (#define sincos _fm_sincos). This routine is
inlined (ie: no additional libraries), and is about 35-45% faster than
calling cos() and sin() alone. However, I am not sure if it will work
while in Allegro enviroment (Why not? Who knows?). Anyway, I cannot test
if the addition is worth. Volunteers?
[ PATCH START ]
--- rotate.c Sun Mar 17 18:53:12 2002
+++ rotnew.c Tue May 21 03:17:38 2002
@@ -23,8 +23,9 @@
#include "allegro.h"
#include "allegro/internal/aintern.h"
#include <math.h>
-
-
+#ifdef ALLEGRO_BCC32
+ #include <fastmath.h>
+#endif
#ifndef M_PI
#define M_PI 3.14159265358979323846
@@ -720,6 +721,8 @@
Todo: Do other platforms support this? (not watcom, mingw or msvc)
*/
sincos(&cos_angle, &sin_angle, angle * (M_PI / (double)0x800000));
+ #elif (defined ALLEGRO_BCC32)
+ sincos(angle * (M_PI / (double)0x800000), &sin_angle, &cos_angle);
#else
cos_angle = cos(angle * (M_PI / (double)0x800000));
sin_angle = sin(angle * (M_PI / (double)0x800000));
[ PATCH END ]
--
Roberto Alfonso (rpgrca@xxxxxxxxxx <> rpgrca@xxxxxxxxxx)
Rhynox, the Noble Rockfriend, Wild Battlerager of the Neidar Clan and
Proficient Blacksmith, rising hero, male dwarf (Genesis is the key)
ICQ: 44361979