projects
/
mesa.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
f0ca9f7
)
util: Define round and roundf on MSVC.
author
José Fonseca
<jfonseca@vmware.com>
Fri, 11 Feb 2011 11:11:33 +0000
(11:11 +0000)
committer
José Fonseca
<jfonseca@vmware.com>
Fri, 11 Feb 2011 11:11:33 +0000
(11:11 +0000)
src/gallium/auxiliary/util/u_math.h
patch
|
blob
|
history
diff --git
a/src/gallium/auxiliary/util/u_math.h
b/src/gallium/auxiliary/util/u_math.h
index 37294b7203f1716df9f7bcdcfcfc026cbbd39efc..30555f92a6d021d9eede41b7e4204aacda1625a4 100644
(file)
--- a/
src/gallium/auxiliary/util/u_math.h
+++ b/
src/gallium/auxiliary/util/u_math.h
@@
-176,7
+176,7
@@
static INLINE float logf( float f )
#define isfinite(x) _finite((double)(x))
#define isnan(x) _isnan((double)(x))
-#endif
+#endif
/* _MSC_VER < 1400 && !defined(__cplusplus) */
static INLINE double log2( double x )
{
@@
-184,6
+184,18
@@
static INLINE double log2( double x )
return log( x ) * invln2;
}
+static INLINE double
+round(double x)
+{
+ return x >= 0.0 ? floor(x + 0.5) : ceil(x - 0.5);
+}
+
+static INLINE float
+roundf(float x)
+{
+ return x >= 0.0f ? floorf(x + 0.5f) : ceilf(x - 0.5f);
+}
+
#endif /* _MSC_VER */