From 8697e134aeac0318e6686d785113f0763cbc3c1c Mon Sep 17 00:00:00 2001 From: David Robillard Date: Fri, 16 Sep 2022 16:27:19 -0400 Subject: Fix signed bitwise operator operands --- test/test_bitvec.cpp | 2 +- test/test_utils.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test_bitvec.cpp b/test/test_bitvec.cpp index a0e8b5b..c123212 100644 --- a/test/test_bitvec.cpp +++ b/test/test_bitvec.cpp @@ -251,7 +251,7 @@ test_find_first(Context&) v.reset(); v.set(i); for (size_t j = i + 1; j < N; ++j) { - v.set(j, rand() & 1); + v.set(j, rand() % 2); } assert(size_t(v.find_first()) == i + 1); } diff --git a/test/test_utils.hpp b/test/test_utils.hpp index 8c95fb4..3388552 100644 --- a/test/test_utils.hpp +++ b/test/test_utils.hpp @@ -49,7 +49,7 @@ make_random_bitvec(Context& ctx) { T v(N); for (size_t i = 0; i < N; ++i) { - v.set(i, ctx.dist(ctx.rng) & 1); + v.set(i, ctx.dist(ctx.rng) & 1U); } return v; } -- cgit v1.2.1