Skip to content

Commit dc44a85

Browse files
committed
Fix clang-tidy compile warning for kPairPrecisionInverse
It looks like kPairPrecisionInverse was incorrectly marked size_t (which is unsigned) instead of int64_t, like kGridLatPrecisionInverse. This caused an implicit conversion from unsigned to signed, which clang_tidy warned about on compilation. I've changed it to int64_t, which does resolve the warning.
1 parent 83986da commit dc44a85

File tree

3 files changed

+5
-4
lines changed

3 files changed

+5
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ MODULE.bazel.lock
1111
**/target/
1212
# Ignore intelliJ auto generated dir
1313
**/.idea/
14+
# Ignore CLion/bazel auto generated dir
15+
**/.clwb/
1416
# Ignore iml extensions files
1517
**/*.iml
1618
# Ignore visual studio auto generated dir

cpp/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,5 +32,5 @@ Code must be formatted using `clang-format`, and this will be checked in the
3232
tests. You can format your code using the script:
3333

3434
```
35-
sh clang_check.sh
35+
bash clang_check.sh
3636
```

cpp/openlocationcode.cc

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
#include "openlocationcode.h"
22

3-
#include <float.h>
4-
53
#include <algorithm>
4+
#include <cfloat>
65
#include <cmath>
76
#include <cstdint>
87

@@ -29,7 +28,7 @@ const size_t kInitialExponent = floor(log(360) / log(kEncodingBase));
2928
const double kGridSizeDegrees =
3029
1 / pow(kEncodingBase, kPairCodeLength / 2 - (kInitialExponent + 1));
3130
// Inverse (1/) of the precision of the final pair digits in degrees. (20^3)
32-
const size_t kPairPrecisionInverse = 8000;
31+
const int64_t kPairPrecisionInverse = 8000;
3332
// Inverse (1/) of the precision of the final grid digits in degrees.
3433
// (Latitude and longitude are different.)
3534
const int64_t kGridLatPrecisionInverse =

0 commit comments

Comments
 (0)