1
0
Fork 0

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 999f5076d1
commit 04d4d01339
2 changed files with 31 additions and 1 deletions

View file

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

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)