From 3e5715a994f9e41ec640185696ce47c170a49cef Mon Sep 17 00:00:00 2001 From: Luis Ibanez Date: Sun, 22 Aug 2010 00:30:23 +0000 Subject: [PATCH] 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. --- libopenjpeg/opj_includes.h | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) 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 */