mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-04 05:20:30 +00:00
Utilities: Use lround() instead of casting round() to long
And one case where we previously cast to int, since the extra precision does not matter.
This commit is contained in:
parent
f2ae25deee
commit
b3cd91d26d
Notes:
sideshowbarker
2024-07-16 22:26:05 +09:00
Author: https://github.com/AtkinsSJ Commit: https://github.com/SerenityOS/serenity/commit/b3cd91d26d Pull-request: https://github.com/SerenityOS/serenity/pull/17793 Reviewed-by: https://github.com/krkk Reviewed-by: https://github.com/trflynn89
3 changed files with 3 additions and 3 deletions
|
@ -21,7 +21,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
args_parser.parse(arguments);
|
||||
|
||||
if (delta.has_value()) {
|
||||
long delta_us = static_cast<long>(round(*delta * 1'000'000));
|
||||
long delta_us = lround(*delta * 1'000'000);
|
||||
timeval delta_timeval;
|
||||
delta_timeval.tv_sec = delta_us / 1'000'000;
|
||||
delta_timeval.tv_usec = delta_us % 1'000'000;
|
||||
|
|
|
@ -69,7 +69,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
for (auto to_print : values_to_print) {
|
||||
switch (to_print) {
|
||||
case AudioVariable::Volume: {
|
||||
auto volume = static_cast<int>(round(audio_client->get_main_mix_volume() * 100));
|
||||
auto volume = lround(audio_client->get_main_mix_volume() * 100);
|
||||
if (human_mode)
|
||||
outln("Volume: {}%", volume);
|
||||
else
|
||||
|
|
|
@ -306,7 +306,7 @@ ErrorOr<int> serenity_main(Main::Arguments arguments)
|
|||
outln("Offset: {}", offset_s);
|
||||
|
||||
if (adjust_time) {
|
||||
long delta_us = static_cast<long>(round(offset_s * 1'000'000));
|
||||
long delta_us = lround(offset_s * 1'000'000);
|
||||
timeval delta_timeval;
|
||||
delta_timeval.tv_sec = delta_us / 1'000'000;
|
||||
delta_timeval.tv_usec = delta_us % 1'000'000;
|
||||
|
|
Loading…
Reference in a new issue