aboutsummaryrefslogtreecommitdiff
path: root/src/core/utils/quantization/AsymmHelpers.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/core/utils/quantization/AsymmHelpers.cpp')
-rw-r--r--src/core/utils/quantization/AsymmHelpers.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/core/utils/quantization/AsymmHelpers.cpp b/src/core/utils/quantization/AsymmHelpers.cpp
index 0dec56c451..086d63b968 100644
--- a/src/core/utils/quantization/AsymmHelpers.cpp
+++ b/src/core/utils/quantization/AsymmHelpers.cpp
@@ -21,11 +21,11 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-#include "arm_compute/core/ActivationLayerInfo.h"
#include "arm_compute/core/utils/quantization/AsymmHelpers.h"
#include "arm_compute/core/Helpers.h"
-#include "support/ToolchainSupport.h"
+#include "arm_compute/function_info/ActivationLayerInfo.h"
#include "src/core/utils/quantization/AsymmHelpers.h"
+#include "support/ToolchainSupport.h"
#include <cmath>
#include <limits>
@@ -240,15 +240,14 @@ void compute_quantized_multipliers_and_shifts(const ITensorInfo *input,
int32_t saturating_rounding_doubling_highmul(int32_t a, int32_t b)
{
- bool overflow = a == b && a == std::numeric_limits<int32_t>::min();
- int64_t a_64(a);
- int64_t b_64(b);
- int64_t ab_64 = a_64 * b_64;
- const bool is_positive_or_zero =
- a == 0 || b == 0 ||
- (std::signbit(static_cast<double>(a)) == std::signbit(static_cast<double>(b)));
- int32_t nudge = is_positive_or_zero ? (1 << 30) : (1 - (1 << 30));
- int32_t ab_x2_high32 = static_cast<int32_t>((ab_64 + nudge) / (1ll << 31));
+ bool overflow = a == b && a == std::numeric_limits<int32_t>::min();
+ int64_t a_64(a);
+ int64_t b_64(b);
+ int64_t ab_64 = a_64 * b_64;
+ const bool is_positive_or_zero =
+ a == 0 || b == 0 || (std::signbit(static_cast<double>(a)) == std::signbit(static_cast<double>(b)));
+ int32_t nudge = is_positive_or_zero ? (1 << 30) : (1 - (1 << 30));
+ int32_t ab_x2_high32 = static_cast<int32_t>((ab_64 + nudge) / (1ll << 31));
return overflow ? std::numeric_limits<int32_t>::max() : ab_x2_high32;
}