pan/bi: Add bi_pack_sync

The type/sync byte, also known as the tag.

Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig@collabora.com>
Reviewed-by: Boris Brezillon <boris.brezillon@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8723>
This commit is contained in:
Alyssa Rosenzweig 2021-01-06 13:39:28 -05:00 committed by Marge Bot
parent 5f523c60fc
commit 2258acf5ca
1 changed files with 30 additions and 0 deletions

View File

@ -668,6 +668,36 @@ bi_pack_tuple_bits(enum bi_clause_subword idx,
return (lo | hi) & ((1ULL << nbits) - 1);
}
static inline uint16_t
bi_pack_lu(enum bi_clause_subword word,
struct bi_packed_tuple *tuples,
ASSERTED unsigned tuple_count)
{
return (word >= BI_CLAUSE_SUBWORD_UPPER_0) ?
bi_pack_upper(word, tuples, tuple_count) :
bi_pack_literal(word);
}
static uint8_t
bi_pack_sync(enum bi_clause_subword t1,
enum bi_clause_subword t2,
enum bi_clause_subword t3,
struct bi_packed_tuple *tuples,
ASSERTED unsigned tuple_count,
bool z)
{
uint8_t sync =
(bi_pack_lu(t3, tuples, tuple_count) << 0) |
(bi_pack_lu(t2, tuples, tuple_count) << 3);
if (t1 == BI_CLAUSE_SUBWORD_Z)
sync |= z << 6;
else
sync |= bi_pack_literal(t1) << 6;
return sync;
}
static void
bi_pack_clause(bi_context *ctx, bi_clause *clause,
bi_clause *next_1, bi_clause *next_2,