intel/isl: Add an isl_assert_div helper
authorJason Ekstrand <jason.ekstrand@intel.com>
Tue, 30 May 2017 15:18:57 +0000 (08:18 -0700)
committerJason Ekstrand <jason.ekstrand@intel.com>
Thu, 1 Jun 2017 22:33:39 +0000 (15:33 -0700)
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@intel.com>
src/intel/isl/isl_priv.h

index 3c4cc1e..186e84d 100644 (file)
@@ -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.
  */