diff --git a/.clang-tidy b/.clang-tidy index ac526f193c..df924ca6a8 100644 --- a/.clang-tidy +++ b/.clang-tidy @@ -2,4 +2,5 @@ Checks: [-*, bugprone-assignment-in-if-condition, bugprone-branch-clone, bugprone-implicit-widening-of-multiplication-result, + bugprone-incorrect-division, ] diff --git a/src/RandTest.cc b/src/RandTest.cc index 3e94dd5556..9d53ddefe3 100644 --- a/src/RandTest.cc +++ b/src/RandTest.cc @@ -60,7 +60,7 @@ void RandTest::add(const void* buf, int bufl) { montey = 0; for ( int mj = 0; mj < RT_MONTEN / 2; mj++ ) { montex = (montex * 256.0) + monte[mj]; - montey = (montey * 256.0) + monte[(RT_MONTEN / 2) + mj]; + montey = (montey * 256.0) + monte[static_cast((RT_MONTEN / 2) + mj)]; } if ( montex * montex + montey * montey <= RT_INCIRC ) { inmont++; diff --git a/src/RandTest.h b/src/RandTest.h index e1f0682fe5..f422cdbbe3 100644 --- a/src/RandTest.h +++ b/src/RandTest.h @@ -4,11 +4,9 @@ #include -#define RT_MONTEN \ - 6 /* Bytes used as Monte Carlo \ - co-ordinates. This should be no more \ - bits than the mantissa of your "double" \ - floating point type. */ +// Bytes used as Monte Carlo co-ordinates. This should be no more bits than the mantissa +// of your "double" floating point type. +constexpr int RT_MONTEN = 6; namespace zeek {