[Mesa-dev] [PATCH 4/6] mesa/main: add IROUNDD64() helper

Iago Toral Quiroga itoral at igalia.com
Thu May 11 11:10:19 UTC 2017


---
 src/mesa/main/imports.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/mesa/main/imports.h b/src/mesa/main/imports.h
index ef7c378..416c59b 100644
--- a/src/mesa/main/imports.h
+++ b/src/mesa/main/imports.h
@@ -165,6 +165,13 @@ static inline GLint64 IROUND64(float f)
    return (GLint64) ((f >= 0.0F) ? (f + 0.5F) : (f - 0.5F));
 }
 
+/**
+ * Convert double to int64 by rounding to nearest integer.
+ */
+static inline GLint64 IROUNDD64(double d)
+{
+   return (GLint64) ((d >= 0.0) ? (d + 0.5) : (d - 0.5));
+}
 
 /**
  * Convert positive float to int by rounding to nearest integer.
-- 
2.9.3



More information about the mesa-dev mailing list