From: Jason Ekstrand Date: Tue, 30 May 2017 15:18:57 +0000 (-0700) Subject: intel/isl: Add an isl_assert_div helper X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=1547d133ac93292a9f57641aea5c7a7672a4a308;p=mesa.git 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 --- diff --git a/src/intel/isl/isl_priv.h b/src/intel/isl/isl_priv.h index 3c4cc1ed95b..186e84db46d 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. */