diff --git a/libopenjpeg/opj_includes.h b/libopenjpeg/opj_includes.h index dbf0f505..b67c9579 100644 --- a/libopenjpeg/opj_includes.h +++ b/libopenjpeg/opj_includes.h @@ -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 */