nir: Use a switch in build_deref_offset()/deref_instr_get_const_offset()
authorBoris Brezillon <boris.brezillon@collabora.com>
Mon, 13 Jul 2020 12:40:38 +0000 (14:40 +0200)
committerBoris Brezillon <boris.brezillon@collabora.com>
Thu, 30 Jul 2020 15:11:35 +0000 (17:11 +0200)
commit6a1382399cbcdab1a3f1fcbec49ad9964961e904
tree3ad936d1eab7b188e74ed1fac76c95793af4b282
parente933ac21cb371d38ac2d1cefa90cedf0b00357b2
nir: Use a switch in build_deref_offset()/deref_instr_get_const_offset()

We are about to add support for casts when calculating offset, but let's
first turn the if()/else if()/else block into a switch() statement to
ease addition of new cases.

Signed-off-by: Boris Brezillon <boris.brezillon@collabora.com>
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5682>
src/compiler/nir/nir_deref.c