diff options
Diffstat (limited to 'include/armnn/Utils.hpp')
-rw-r--r-- | include/armnn/Utils.hpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/armnn/Utils.hpp b/include/armnn/Utils.hpp index 7c1f096823..8976b38ecc 100644 --- a/include/armnn/Utils.hpp +++ b/include/armnn/Utils.hpp @@ -5,6 +5,7 @@ #pragma once #include <string> +#include <cmath> namespace armnn { @@ -39,4 +40,10 @@ bool NeonDetected(); const std::string GetVersion(); +inline float roundf(float value) +{ + // Workaround Valgrind's mismatches: when running from Valgrind the call to std::round(4.5) == 4.0 instead of 5.0 + return (value < 0.f) ? ::floorf(value - 0.5f) : ::floorf(value + 0.5f); +} + } // namespace armnn |