util/ra: Fix numeric overflow during bitset allocation
Reviewed-by: Emma Anholt <emma@anholt.net>
Signed-off-by: Kostiantyn Lazukin <kostiantyn.lazukin@globallogic.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/5752
Fixes: d4a4cd20d5
("util/ra: use adjacency matrix for undirected graph")
Reviewed-by: Jordan Justen <jordan.l.justen@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14224>
This commit is contained in:
parent
84b21fea46
commit
e9cc1633a2
|
@ -472,13 +472,13 @@ ra_set_deserialize(void *mem_ctx, struct blob_reader *blob)
|
|||
return regs;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
ra_get_num_adjacency_bits(unsigned int n)
|
||||
static uint64_t
|
||||
ra_get_num_adjacency_bits(uint64_t n)
|
||||
{
|
||||
return (n * (n - 1)) / 2;
|
||||
}
|
||||
|
||||
static unsigned
|
||||
static uint64_t
|
||||
ra_get_adjacency_bit_index(unsigned n1, unsigned n2)
|
||||
{
|
||||
assert(n1 != n2);
|
||||
|
@ -490,7 +490,7 @@ ra_get_adjacency_bit_index(unsigned n1, unsigned n2)
|
|||
static bool
|
||||
ra_test_adjacency_bit(struct ra_graph *g, unsigned n1, unsigned n2)
|
||||
{
|
||||
unsigned index = ra_get_adjacency_bit_index(n1, n2);
|
||||
uint64_t index = ra_get_adjacency_bit_index(n1, n2);
|
||||
return BITSET_TEST(g->adjacency, index);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue