diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/igt_aux.h | 2 | ||||
-rw-r--r-- | lib/igt_core.h | 52 |
2 files changed, 54 insertions, 0 deletions
diff --git a/lib/igt_aux.h b/lib/igt_aux.h index faddd478..9bb03b77 100644 --- a/lib/igt_aux.h +++ b/lib/igt_aux.h @@ -390,4 +390,6 @@ static inline bool igt_list_empty(const struct igt_list *list) __builtin_popcountll(x), \ __builtin_popcount(x)) +#define is_power_of_two(x) (((x) & ((x)-1)) == 0) + #endif /* IGT_AUX_H */ diff --git a/lib/igt_core.h b/lib/igt_core.h index 57e97f2b..bf8cd66c 100644 --- a/lib/igt_core.h +++ b/lib/igt_core.h @@ -576,6 +576,32 @@ static inline void igt_ignore_warn(bool value) #define igt_assert_lte(n1, n2) igt_assert_cmpint(n1, <=, >, n2) /** + * igt_assert_lte_u64: + * @n1: first integer + * @n2: second integer + * + * Fails (sub-)test if the second integer is strictly smaller than the first. + * Beware that for now this only works on integers. + * + * Like igt_assert(), but displays the values being compared on failure instead + * of simply printing the stringified expression. + */ +#define igt_assert_lte_u64(n1, n2) igt_assert_cmpu64(n1, <=, >, n2) + +/** + * igt_assert_lte_s64: + * @n1: first integer + * @n2: second integer + * + * Fails (sub-)test if the second integer is strictly smaller than the first. + * Beware that for now this only works on integers. + * + * Like igt_assert(), but displays the values being compared on failure instead + * of simply printing the stringified expression. + */ +#define igt_assert_lte_s64(n1, n2) igt_assert_cmps64(n1, <=, >, n2) + +/** * igt_assert_lt: * @n1: first integer * @n2: second integer @@ -589,6 +615,32 @@ static inline void igt_ignore_warn(bool value) #define igt_assert_lt(n1, n2) igt_assert_cmpint(n1, <, >=, n2) /** + * igt_assert_lt_u64: + * @n1: first integer + * @n2: second integer + * + * Fails (sub-)test if the second integer is smaller than or equal to the first. + * Beware that for now this only works on integers. + * + * Like igt_assert(), but displays the values being compared on failure instead + * of simply printing the stringified expression. + */ +#define igt_assert_lt_u64(n1, n2) igt_assert_cmpu64(n1, <, >=, n2) + +/** + * igt_assert_lt_s64: + * @n1: first integer + * @n2: second integer + * + * Fails (sub-)test if the second integer is smaller than or equal to the first. + * Beware that for now this only works on integers. + * + * Like igt_assert(), but displays the values being compared on failure instead + * of simply printing the stringified expression. + */ +#define igt_assert_lt_s64(n1, n2) igt_assert_cmps64(n1, <, >=, n2) + +/** * igt_assert_fd: * @fd: file descriptor * |