Mesa (master): intel/isl: Add an isl_assert_div helper
Jason Ekstrand
jekstrand at kemper.freedesktop.org
Thu Jun 1 22:43:15 UTC 2017
Module: Mesa
Branch: master
Commit: 1547d133ac93292a9f57641aea5c7a7672a4a308
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=1547d133ac93292a9f57641aea5c7a7672a4a308
Author: Jason Ekstrand <jason.ekstrand at intel.com>
Date: Tue May 30 08:18:57 2017 -0700
intel/isl: Add an isl_assert_div helper
This is a fairly common operation and it's nice to be able to just call
the one little function.
Reviewed-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
src/intel/isl/isl_priv.h | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/intel/isl/isl_priv.h b/src/intel/isl/isl_priv.h
index 3c4cc1ed95..186e84db46 100644
--- a/src/intel/isl/isl_priv.h
+++ b/src/intel/isl/isl_priv.h
@@ -80,6 +80,13 @@ isl_align_npot(uintmax_t n, uintmax_t a)
return ((n + a - 1) / a) * a;
}
+static inline uintmax_t
+isl_assert_div(uintmax_t n, uintmax_t a)
+{
+ assert(n % a == 0);
+ return n / a;
+}
+
/**
* Alignment must be a power of 2.
*/
More information about the mesa-commit
mailing list