[PATCH i-g-t 03/20] lib: Define DIV_ROUND_CLOSEST()
Ville Syrjala
ville.syrjala at linux.intel.com
Fri May 31 14:23:37 UTC 2024
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Add a helper for integer division with round to closest behaviour.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
lib/igt_aux.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 4664559dca82..4b8116dc0998 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -335,6 +335,7 @@ void pipewire_pulse_stop_reserve(void);
#define roundup_power_of_two(x) ((x) != 0 ? 1ULL << igt_fls((x) - 1) : 0)
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
+#define DIV_ROUND_CLOSEST(n, d) (((n) + (d) / 2) / (d))
uint64_t vfs_file_max(void);
--
2.44.1
More information about the igt-dev
mailing list