summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuis Ibanez <luis.ibanez@gmail.com>2010-08-22 00:30:23 +0000
committerLuis Ibanez <luis.ibanez@gmail.com>2010-08-22 00:30:23 +0000
commit3e5715a994f9e41ec640185696ce47c170a49cef (patch)
tree51d6e844c657c10b5e1b2a32685d4b7655225da1
parent9f446c88e874effa5eca6432b0f0faf3a7ce4784 (diff)
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.
-rw-r--r--libopenjpeg/opj_includes.h22
1 files changed, 21 insertions, 1 deletions
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 */