pan/bi: Add instruction equality helper

Useful for unit testing.

Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12026>
This commit is contained in:
Alyssa Rosenzweig
2021-07-22 11:58:32 -04:00
committed by Marge Bot
parent 0394cc7c1d
commit 6053741610
+10
View File
@@ -58,4 +58,14 @@ bit_builder(void *memctx)
return b;
}
/* Helper to compare for logical equality of instructions. Need to skip over
* the link, guaranteed to be first. After that we can compare raw data. */
static inline bool
bit_instr_equal(bi_instr *A, bi_instr *B)
{
return memcmp((uint8_t *) A + sizeof(struct list_head),
(uint8_t *) B + sizeof(struct list_head),
sizeof(bi_instr) - sizeof(struct list_head)) == 0;
}
#endif