Fix cert-dcl16-c clang-tidy warnings.
Bug: 120614316
Test: make with WITH_TIDY=1 DEFAULT_GLOBAL_TIDY_CHECKS=-*,cert-dcl16-c
Change-Id: I7ecc19569ed7a25f454111dd642359684cce8adb
diff --git a/common/OperationsUtils.cpp b/common/OperationsUtils.cpp
index 877b7e3..8c0afd3 100644
--- a/common/OperationsUtils.cpp
+++ b/common/OperationsUtils.cpp
@@ -136,9 +136,9 @@
NN_OPS_CHECK(double_multiplier > 0.);
const double q = std::frexp(double_multiplier, right_shift);
*right_shift *= -1;
- int64_t q_fixed = static_cast<int64_t>(std::round(q * (1ll << 31)));
- NN_OPS_CHECK(q_fixed <= (1ll << 31));
- if (q_fixed == (1ll << 31)) {
+ int64_t q_fixed = static_cast<int64_t>(std::round(q * (1LL << 31)));
+ NN_OPS_CHECK(q_fixed <= (1LL << 31));
+ if (q_fixed == (1LL << 31)) {
q_fixed /= 2;
--*right_shift;
}
@@ -153,9 +153,9 @@
int* left_shift) {
NN_OPS_CHECK(double_multiplier > 1.);
const double q = std::frexp(double_multiplier, left_shift);
- int64_t q_fixed = static_cast<int64_t>(std::round(q * (1ll << 31)));
- NN_OPS_CHECK(q_fixed <= (1ll << 31));
- if (q_fixed == (1ll << 31)) {
+ int64_t q_fixed = static_cast<int64_t>(std::round(q * (1LL << 31)));
+ NN_OPS_CHECK(q_fixed <= (1LL << 31));
+ if (q_fixed == (1LL << 31)) {
q_fixed /= 2;
++*left_shift;
}
@@ -236,8 +236,8 @@
int32_t CalculateInputRadius(int input_integer_bits, int input_left_shift) {
const double max_input_rescaled = 1.0 * ((1 << input_integer_bits) - 1) *
- (1ll << (31 - input_integer_bits)) /
- (1ll << input_left_shift);
+ (1LL << (31 - input_integer_bits)) /
+ (1LL << input_left_shift);
// Tighten bound using floor. Suppose that we could use the exact value.
// After scaling the difference, the result would be at the maximum. Thus we
// must ensure that our value has lower magnitude.