[PATCH i-g-t 13/14] lib/igt_aux: Add igt_ror() and igt_rol()
Ville Syrjala
ville.syrjala at linux.intel.com
Fri Oct 4 10:41:20 UTC 2024
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Add helpers to do bitwise rotate operatios.
igt_rol(): bitwise rotate left
igt_ror(): bitwise rotate right
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
lib/igt_aux.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 4b8116dc0998..bfd83adcacb9 100644
--- a/lib/igt_aux.h
+++ b/lib/igt_aux.h
@@ -337,6 +337,13 @@ void pipewire_pulse_stop_reserve(void);
#define DIV_ROUND_UP(n, d) (((n) + (d) - 1) / (d))
#define DIV_ROUND_CLOSEST(n, d) (((n) + (d) / 2) / (d))
+#define igt_rol(value, shift, size) \
+ (((value) << (shift)) | \
+ ((value) >> ((size) - (shift))))
+#define igt_ror(value, shift, size) \
+ (((value) >> (shift)) | \
+ ((value) << ((size) - (shift))))
+
uint64_t vfs_file_max(void);
void *igt_memdup(const void *ptr, size_t len);
--
2.45.2
More information about the igt-dev
mailing list