MAT3mat.c: Borland tweaks.
mat3.h: Some inline assembly from Norman.
This commit is contained in:
parent
999f5076d1
commit
04d4d01339
2 changed files with 31 additions and 1 deletions
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in a new issue