[Mesa-dev] [PATCH 1/4] util: Add _mesa_llroundevenf().

Matt Turner mattst88 at gmail.com
Thu May 26 18:28:47 UTC 2016


---
 src/util/rounding.h | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/src/util/rounding.h b/src/util/rounding.h
index afb38fb..8a3e630 100644
--- a/src/util/rounding.h
+++ b/src/util/rounding.h
@@ -112,6 +112,20 @@ _mesa_lroundevenf(float x)
  * \brief Rounds \c x to the nearest integer, with ties to the even integer,
  * and returns the value as a long int.
  */
+static inline long long
+_mesa_llroundevenf(float x)
+{
+#if defined __x86_64__ && LONG_BIT == 64
+   return _mm_cvtss_si64(_mm_load_ss(&x));
+#else
+   return llrintf(x);
+#endif
+}
+
+/**
+ * \brief Rounds \c x to the nearest integer, with ties to the even integer,
+ * and returns the value as a long int.
+ */
 static inline long
 _mesa_lroundeven(double x)
 {
-- 
2.7.3



More information about the mesa-dev mailing list