diff options
author | Cameron Cawley | 2019-10-03 22:10:00 +0100 |
---|---|---|
committer | David Turner | 2019-10-03 23:52:46 +0100 |
commit | 3cb6a84f035b40b4c4862719811a04e02afe2137 (patch) | |
tree | 7c2e51030829980ab7eec5a92afee3e4c50cde6b /common | |
parent | 9368323cdf182121577511b129f8d981c364a34b (diff) | |
download | scummvm-rg350-3cb6a84f035b40b4c4862719811a04e02afe2137.tar.gz scummvm-rg350-3cb6a84f035b40b4c4862719811a04e02afe2137.tar.bz2 scummvm-rg350-3cb6a84f035b40b4c4862719811a04e02afe2137.zip |
BLADERUNNER: Remove use of C99 math functions
Diffstat (limited to 'common')
-rw-r--r-- | common/math.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/common/math.h b/common/math.h index 7b2ec6060e..2c62fce6d5 100644 --- a/common/math.h +++ b/common/math.h @@ -107,6 +107,20 @@ inline int intLog2(uint32 v) { } #endif +// Round a number towards zero +// Input and Output type can be different +template<class InputT, class OutputT> +inline OutputT trunc(InputT x) { + return (x > 0) ? floor(x) : ceil(x); +} + +// Round a number towards zero +// Input and Output type are the same +template<class T> +inline T trunc(T x) { + return trunc<T,T>(x); +} + // Convert radians to degrees // Input and Output type can be different // Upconvert everything to floats |