From 1547d133ac93292a9f57641aea5c7a7672a4a308 Mon Sep 17 00:00:00 2001 From: Jason Ekstrand Date: Tue, 30 May 2017 08:18:57 -0700 Subject: [PATCH] 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 --- 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 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. */ -- 2.30.2