1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-20 14:55:08 +00:00

Everywhere: Add -Wdouble-promotion warning

This warning informs of float-to-double conversions. The best solution
seems to be to do math *either* in 32-bit *or* in 64-bit, and only to
cross over when absolutely necessary.
This commit is contained in:
Nicholas-Baron 2021-04-15 00:36:14 -07:00 committed by Andreas Kling
parent 6606d70826
commit 73dd293ec4
26 changed files with 105 additions and 98 deletions

View file

@ -74,7 +74,7 @@ private:
m_last_cpu_idle = idle;
float cpu = (float)busy_diff / (float)(busy_diff + idle_diff);
m_history.enqueue(cpu);
m_tooltip = String::format("CPU usage: %.1f%%", 100 * cpu);
m_tooltip = String::formatted("CPU usage: {:.1}%", 100 * cpu);
} else {
m_history.enqueue(-1);
m_tooltip = StringView("Unable to determine CPU usage");
@ -87,7 +87,7 @@ private:
double total_memory = allocated + available;
double memory = (double)allocated / total_memory;
m_history.enqueue(memory);
m_tooltip = String::format("Memory: %.1f MiB of %.1f MiB in use", (float)(allocated / MiB), (float)(total_memory / MiB));
m_tooltip = String::formatted("Memory: {} MiB of {:.1} MiB in use", allocated / MiB, total_memory / MiB);
} else {
m_history.enqueue(-1);
m_tooltip = StringView("Unable to determine memory usage");