diff options
author | Dylan Baker <[email protected]> | 2018-09-10 10:22:42 -0700 |
---|---|---|
committer | Dylan Baker <[email protected]> | 2020-04-21 11:09:03 -0700 |
commit | 53c36dfcfe3eb3749a53267f054870280afb0d71 (patch) | |
tree | 7d178170b8324ce2ec4fed64e66a146c173edf97 /src/util | |
parent | df3ce8fb77e718ee4371fe7ca9f4a7c889319efb (diff) |
replace IROUND with util functions
This adds two new util functions to rounding.h, _mesa_iroundf and
mesa_lround, which are just wrappers around roundf and round, that cast
to int and long int respectively. This is possible since mesa recently
dropped support for VC2013, since 2015 and 2017 support roundf.
Reviewed-by: Marek Olšák <[email protected]>
Reviewed-by: Kristian H. Kristensen <[email protected]>
Reviewed-by: Matt Turner <[email protected]>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3024>
Diffstat (limited to 'src/util')
-rw-r--r-- | src/util/imports.h | 17 | ||||
-rw-r--r-- | src/util/rounding.h | 1 |
2 files changed, 1 insertions, 17 deletions
diff --git a/src/util/imports.h b/src/util/imports.h index 3a73275ffd6..149bb225ad4 100644 --- a/src/util/imports.h +++ b/src/util/imports.h @@ -95,23 +95,6 @@ typedef union { float f; int i; unsigned u; } fi_type; #endif -/** - * Convert float to int by rounding to nearest integer, away from zero. - */ -static inline int IROUND(float f) -{ - return (int) ((f >= 0.0F) ? (f + 0.5F) : (f - 0.5F)); -} - -/** - * Convert float to int64 by rounding to nearest integer. - */ -static inline int64_t IROUND64(float f) -{ - return (int64_t) ((f >= 0.0F) ? (f + 0.5F) : (f - 0.5F)); -} - - /********************************************************************** * Functions */ diff --git a/src/util/rounding.h b/src/util/rounding.h index d3fe8edb7f8..e329d438244 100644 --- a/src/util/rounding.h +++ b/src/util/rounding.h @@ -108,6 +108,7 @@ _mesa_lroundevenf(float x) #endif } + /** * \brief Rounds \c x to the nearest integer, with ties to the even integer, * and returns the value as a long int. |