yul-phaser: A few more tweaks to ensure that signedness conversions do not cause warnings

- Don't cast booleans to int when the result gets assigned to an unsigned type. Relace them with ifs.
- Use unsigned initializer for a variable declared in a lambda capture.
- Unsigned abs() of a difference of unsigned values.
This commit is contained in:
Djordje Mijovic
2020-06-04 17:18:07 +02:00
committed by Kamil Śliwak
parent a49a127627
commit 9b3d1c11ff
3 changed files with 9 additions and 5 deletions
+2 -2
View File
@@ -179,8 +179,8 @@ BOOST_AUTO_TEST_CASE(alternativeMutations_should_choose_between_mutations_with_g
for (size_t i = 0; i < 10; ++i)
{
Chromosome mutatedChromosome = mutation(chromosome);
cCount += static_cast<int>(mutatedChromosome == Chromosome("c"));
fCount += static_cast<int>(mutatedChromosome == Chromosome("f"));
cCount += (mutatedChromosome == Chromosome("c") ? 1 : 0);
fCount += (mutatedChromosome == Chromosome("f") ? 1 : 0);
}
// This particular seed results in 7 "c"s out of 10 which looks plausible given the 80% chance.