[PATCH i-g-t 1/3] lib/drmtest: Add IS_ALIGNED macro
Piórkowski, Piotr
piotr.piorkowski at intel.com
Fri Mar 1 15:15:39 UTC 2024
From: Piotr Piórkowski <piotr.piorkowski at intel.com>
Let's add a new macro that will be used to verify whether one value is
aligned to the other.
Signed-off-by: Piotr Piórkowski <piotr.piorkowski at intel.com>
---
lib/drmtest.h | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/lib/drmtest.h b/lib/drmtest.h
index 6bc819734..588d7da17 100644
--- a/lib/drmtest.h
+++ b/lib/drmtest.h
@@ -99,6 +99,15 @@ void __set_forced_driver(const char *name);
*/
#define ALIGN_DOWN(x, a) ALIGN((x) - ((a) - 1), (a))
+/**
+ * IS_ALIGNED:
+ * @v: value to check
+ * @a: alignment unit in bytes
+ *
+ * Macro to check if value @v is aligned to @a
+ */
+#define IS_ALIGNED(v, a) (((v) & ((typeof(v))(a) - 1)) == 0)
+
int __drm_open_device(const char *name, unsigned int chipset);
void drm_load_module(unsigned int chipset);
int drm_open_driver(int chipset);
--
2.34.1
More information about the igt-dev
mailing list