[libc-commits] [libc] [libc] Fix Cppcheck Issues (PR #96999)
Joseph Huber via libc-commits
libc-commits at lists.llvm.org
Fri Jun 28 06:16:37 PDT 2024
================
@@ -92,23 +92,22 @@ BenchmarkResult benchmark(const BenchmarkOptions &options,
for (int i = 0; i < overhead_iterations; i++)
overhead = cpp::min(overhead, LIBC_NAMESPACE::overhead());
- for (uint64_t time_budget = options.max_duration; time_budget >= 0;) {
+ for (uint64_t time_budget = options.max_duration; time_budget != 0;) {
----------------
jhuber6 wrote:
This should definitely be `int64_t`. There's a *very* slim chance you will actually get zero if you keep subtracting. Remember, integer overflow / underflow is not undefined behavior for unsigned values, so `1 - 2 == 18,446,744,073,709,551,615`.
https://github.com/llvm/llvm-project/pull/96999
More information about the libc-commits
mailing list