Fix clang-tidy bugprone-incorrect-division warnings

This commit is contained in:
Tim Wojtulewicz 2025-04-16 12:35:18 -07:00
parent 18983aed02
commit 87f1b1a7b3
3 changed files with 5 additions and 6 deletions

View file

@ -2,4 +2,5 @@ Checks: [-*,
bugprone-assignment-in-if-condition,
bugprone-branch-clone,
bugprone-implicit-widening-of-multiplication-result,
bugprone-incorrect-division,
]

View file

@ -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<size_t>((RT_MONTEN / 2) + mj)];
}
if ( montex * montex + montey * montey <= RT_INCIRC ) {
inmont++;

View file

@ -4,11 +4,9 @@
#include <cstdint>
#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 {