MAT3mat.c: Borland tweaks.

mat3.h:  Some inline assembly from Norman.
This commit is contained in:
curt 1999-04-22 18:46:27 +00:00
parent 53fbb98d4f
commit 294a0dde63
2 changed files with 31 additions and 1 deletions

View File

@ -12,7 +12,11 @@
#ifdef WIN32
# ifndef HAVE_STL_SGI_PORT
# include <memory.h> /* required for memset() and memcpy() */
# ifdef __BORLANDC__
# include <mem.h>
# else
# include <memory.h> /* required for memset() and memcpy() */
# endif
# endif
#endif

View File

@ -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)