BUG: The _asm directive is not available in Visual Studio 9, 64bits.

An alternative vainilla implementation has been added here, based
on code from VXL, vnl_math.h.
This commit is contained in:
Luis Ibanez 2010-08-22 00:30:23 +00:00
parent 9f446c88e8
commit 3e5715a994
1 changed files with 21 additions and 1 deletions

View File

@ -89,6 +89,9 @@ Most compilers implement their own version of this keyword ...
/* MSVC and Borland C do not have lrintf */
#if defined(_MSC_VER) || defined(__BORLANDC__)
/* MSVC 64bits doesn't support _asm */
#if !defined(_WIN64)
static INLINE long lrintf(float f){
int i;
@ -97,8 +100,25 @@ static INLINE long lrintf(float f){
fistp i
};
return i;
return i;
}
#else
static INLINE long lrintf(float x){
int r;
if (x>=0.f)
{
x+=0.5f;
}
else
{
x-=0.5f;
}
r = (int)(x);
if ( x != (float)(r) ) return r;
return 2*(r/2);
}
#endif
#endif
#endif /* OPJ_INCLUDES_H */