Avoid double promotion.
A floating point literal without a type specifier is a double and causes the float to be promoted to double as well. It has no advantages in these cases so avoid it. (Found with gcc -Wdouble-promotion.)
This commit is contained in:
parent
4173462368
commit
d4fcad4944
2 changed files with 8 additions and 8 deletions
|
@ -889,8 +889,8 @@ WML_HANDLER_FUNCTION(volume, /*event_info*/, cfg)
|
|||
if(!music.empty()) {
|
||||
vol = preferences::music_volume();
|
||||
rel = atof(music.c_str());
|
||||
if (rel >= 0.0 && rel < 100.0) {
|
||||
vol = static_cast<int>(rel*vol/100.0);
|
||||
if (rel >= 0.0f && rel < 100.0f) {
|
||||
vol = static_cast<int>(rel*vol/100.0f);
|
||||
}
|
||||
sound::set_music_volume(vol);
|
||||
}
|
||||
|
@ -898,8 +898,8 @@ WML_HANDLER_FUNCTION(volume, /*event_info*/, cfg)
|
|||
if(!sound.empty()) {
|
||||
vol = preferences::sound_volume();
|
||||
rel = atof(sound.c_str());
|
||||
if (rel >= 0.0 && rel < 100.0) {
|
||||
vol = static_cast<int>(rel*vol/100.0);
|
||||
if (rel >= 0.0f && rel < 100.0f) {
|
||||
vol = static_cast<int>(rel*vol/100.0f);
|
||||
}
|
||||
sound::set_sound_volume(vol);
|
||||
}
|
||||
|
|
|
@ -694,8 +694,8 @@ BOOST_AUTO_TEST_CASE(test_o_modification_decoding_percent_args)
|
|||
// The dynamic_cast returns NULL if the argument doesn't match the type
|
||||
BOOST_REQUIRE(mod != NULL);
|
||||
|
||||
BOOST_CHECK(mod->get_opacity() > 0.44);
|
||||
BOOST_CHECK(mod->get_opacity() < 0.46);
|
||||
BOOST_CHECK(mod->get_opacity() > 0.44f);
|
||||
BOOST_CHECK(mod->get_opacity() < 0.46f);
|
||||
|
||||
delete mod;
|
||||
}
|
||||
|
@ -714,8 +714,8 @@ BOOST_AUTO_TEST_CASE(test_o_modification_decoding_fraction_args)
|
|||
// The dynamic_cast returns NULL if the argument doesn't match the type
|
||||
BOOST_REQUIRE(mod != NULL);
|
||||
|
||||
BOOST_CHECK(mod->get_opacity() > 0.33);
|
||||
BOOST_CHECK(mod->get_opacity() < 0.35);
|
||||
BOOST_CHECK(mod->get_opacity() > 0.33f);
|
||||
BOOST_CHECK(mod->get_opacity() < 0.35f);
|
||||
|
||||
delete mod;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue