mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2024-12-29 11:06:18 +00:00
a/util: Manual fixes to clang-tidy issues.
This commit is contained in:
parent
f769ff8977
commit
4939bc2f59
|
@ -52,7 +52,7 @@ u_frame_times_widget_push_sample(struct u_frame_times_widget *widget, uint64_t n
|
|||
|
||||
for (int i = 0; i < NUM_FRAME_TIMINGS; i++) {
|
||||
uint64_t frametime_ns = widget->times_ns[i + 1] - widget->times_ns[i];
|
||||
float frametime_s = frametime_ns * 1.f / 1000.f * 1.f / 1000.f * 1.f / 1000.f;
|
||||
float frametime_s = (float)time_ns_to_s(frametime_ns);
|
||||
total_s += frametime_s;
|
||||
}
|
||||
float avg_frametime_s = total_s / ((float)NUM_FRAME_TIMINGS);
|
||||
|
@ -62,7 +62,7 @@ u_frame_times_widget_push_sample(struct u_frame_times_widget *widget, uint64_t n
|
|||
widget->times_ns[widget->index] = new_frame_time;
|
||||
|
||||
uint64_t diff = widget->times_ns[widget->index] - widget->times_ns[last_index];
|
||||
widget->timings_ms[widget->index] = (float)diff * 1.f / 1000.f * 1.f / 1000.f;
|
||||
widget->timings_ms[widget->index] = (float)time_ns_to_ms_f(diff);
|
||||
}
|
||||
|
||||
static inline void
|
||||
|
|
|
@ -25,7 +25,7 @@ extern "C" {
|
|||
#endif
|
||||
|
||||
//! Helper define to make code more readable.
|
||||
#define U_1_000_000_000 (1000000000)
|
||||
#define U_1_000_000_000 (1000 * 1000 * 1000)
|
||||
|
||||
/*!
|
||||
* The number of nanoseconds in a second.
|
||||
|
@ -36,18 +36,18 @@ extern "C" {
|
|||
#define U_TIME_1S_IN_NS U_1_000_000_000
|
||||
|
||||
/*!
|
||||
* The number of nanoseconds in a milliseconds.
|
||||
* The number of nanoseconds in a millisecond.
|
||||
*
|
||||
* @see timepoint_ns
|
||||
*/
|
||||
#define U_TIME_1MS_IN_NS (U_TIME_1S_IN_NS / 1000)
|
||||
#define U_TIME_1MS_IN_NS (1000 * 1000)
|
||||
|
||||
/*!
|
||||
* The number of nanoseconds in half a milliseconds.
|
||||
* The number of nanoseconds in half a millisecond.
|
||||
*
|
||||
* @see timepoint_ns
|
||||
*/
|
||||
#define U_TIME_HALF_MS_IN_NS (U_TIME_1MS_IN_NS / 2)
|
||||
#define U_TIME_HALF_MS_IN_NS (U_TIME_1MS_IN_NS / 2.0)
|
||||
|
||||
/*!
|
||||
* Integer timestamp type.
|
||||
|
@ -78,7 +78,7 @@ typedef int64_t time_duration_ns;
|
|||
static inline double
|
||||
time_ns_to_s(time_duration_ns ns)
|
||||
{
|
||||
return (double)(ns) / (double)U_TIME_1S_IN_NS;
|
||||
return (double)(ns) / (double)(U_TIME_1S_IN_NS);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
@ -102,7 +102,7 @@ time_s_to_ns(double duration)
|
|||
static inline double
|
||||
time_ns_to_ms_f(time_duration_ns ns)
|
||||
{
|
||||
return (double)(ns) / (double)U_TIME_1MS_IN_NS;
|
||||
return (double)(ns) / (double)(U_TIME_1MS_IN_NS);
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
Loading…
Reference in a new issue