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:
parent
9f446c88e8
commit
3e5715a994
|
@ -89,6 +89,9 @@ Most compilers implement their own version of this keyword ...
|
||||||
|
|
||||||
/* MSVC and Borland C do not have lrintf */
|
/* MSVC and Borland C do not have lrintf */
|
||||||
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
#if defined(_MSC_VER) || defined(__BORLANDC__)
|
||||||
|
|
||||||
|
/* MSVC 64bits doesn't support _asm */
|
||||||
|
#if !defined(_WIN64)
|
||||||
static INLINE long lrintf(float f){
|
static INLINE long lrintf(float f){
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
@ -97,8 +100,25 @@ static INLINE long lrintf(float f){
|
||||||
fistp i
|
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
|
||||||
|
|
||||||
#endif /* OPJ_INCLUDES_H */
|
#endif /* OPJ_INCLUDES_H */
|
||||||
|
|
Loading…
Reference in New Issue