From 04d4d0133936a97930deffa859d2a20b7789dd28 Mon Sep 17 00:00:00 2001 From: curt Date: Thu, 22 Apr 1999 18:46:27 +0000 Subject: [PATCH] MAT3mat.c: Borland tweaks. mat3.h: Some inline assembly from Norman. --- Lib/Math/MAT3mat.c | 6 +++++- Lib/Math/mat3.h | 26 ++++++++++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Lib/Math/MAT3mat.c b/Lib/Math/MAT3mat.c index 4355f1769..2054f7731 100644 --- a/Lib/Math/MAT3mat.c +++ b/Lib/Math/MAT3mat.c @@ -12,7 +12,11 @@ #ifdef WIN32 # ifndef HAVE_STL_SGI_PORT -# include /* required for memset() and memcpy() */ +# ifdef __BORLANDC__ +# include +# else +# include /* required for memset() and memcpy() */ +# endif # endif #endif diff --git a/Lib/Math/mat3.h b/Lib/Math/mat3.h index e11896ce1..cb8a0d33b 100644 --- a/Lib/Math/mat3.h +++ b/Lib/Math/mat3.h @@ -47,6 +47,32 @@ typedef double MAT3hvec[4]; /* Vector with homogeneous coord */ extern MAT3mat identityMatrix; +#if defined(i386) +#define USE_X86_ASM +#endif + +#if defined(USE_X86_ASM) +static __inline__ int FloatToInt(float f) +{ + int r; + __asm__ ("fistpl %0" : "=m" (r) : "t" (f) : "st"); + return r; +} +#elif defined(__MSC__) && defined(__WIN32__) +static __inline int FloatToInt(float f) +{ + int r; + _asm { + fld f + fistp r + } + return r; +} +#else +#define FloatToInt(F) ((int) (F)) +#endif + + /* Tests if a number is within EPSILON of zero */ #define MAT3_IS_ZERO(N) ((N) < MAT3_EPSILON && (N) > -MAT3_EPSILON)