aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/rounding.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/rounding.h')
-rw-r--r--src/util/rounding.h25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/util/rounding.h b/src/util/rounding.h
index 0cbe9269f7b..088cf86dd08 100644
--- a/src/util/rounding.h
+++ b/src/util/rounding.h
@@ -21,6 +21,9 @@
* IN THE SOFTWARE.
*/
+#ifndef _ROUNDING_H
+#define _ROUNDING_H
+
#include <math.h>
#ifdef __SSE4_1__
@@ -76,3 +79,25 @@ _mesa_roundeven(double x)
return rint(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_lroundevenf(float x)
+{
+ return lrintf(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
+_mesa_lroundeven(double x)
+{
+ return lrint(x);
+}
+
+#endif