summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVille Syrjälä <ville.syrjala@linux.intel.com>2024-10-04 13:41:20 +0300
committerVille Syrjälä <ville.syrjala@linux.intel.com>2024-10-30 20:12:36 +0200
commit2339a396e8c38ba1582a6fc18fe4f7ed178979cc (patch)
treef4044835e580d5424504ab52986b14348f117bc5
parenta74e39da9ad1fa66f73ddc5b5d056062bcbeb89b (diff)
lib/igt_aux: Add igt_ror() and igt_rol()
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@linux.intel.com> Reviewed-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
-rw-r--r--lib/igt_aux.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h
index 4b8116dc0..bfd83adca 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);