util: Add util_widen_mask function.
authorTimur Kristóf <timur.kristof@gmail.com>
Wed, 1 Dec 2021 18:37:02 +0000 (19:37 +0100)
committerMarge Bot <emma+marge@anholt.net>
Fri, 3 Dec 2021 18:29:13 +0000 (18:29 +0000)
commit6cde424945181d352c494f6511105000c3e5b805
tree38c3c660a10a28358971c98af133eb5f3e3f136e
parent7e66da89f8aad7a6d0df57d2efa34a23bb526da0
util: Add util_widen_mask function.

Widens the given bit mask by a multiplier, meaning that it will
replicate each bit by that amount.
For example: 0b101 widened by 2 will become: 0b110011

This is typically used in shader I/O to transform a 64-bit
writemask to a 32-bit writemask.

Moving this function here because it is used in multiple places.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14005>
src/util/bitscan.h