summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErico Nunes <nunes.erico@gmail.com>2022-02-05 11:14:36 +0100
committerMarge Bot <emma+marge@anholt.net>2022-02-11 21:55:10 +0000
commit0f9756f4808739c8b18e62e28bdbb430af735c67 (patch)
tree592648667de7cf744e4f3eacbceb5b1040ff2092
parent7297f931f04bedb2a49a723972e5de8daad7b487 (diff)
lima/ppir: refactor bitcopy to use unsigned char
This code does not work as expected when built with clang and -fstrict-aliasing. Redefine it in unsigned char operations so that it does not violate strict aliasing rules. Signed-off-by: Erico Nunes <nunes.erico@gmail.com> Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com> Cc: 22.0 <mesa-stable> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14894>
-rw-r--r--src/gallium/drivers/lima/ir/pp/codegen.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/gallium/drivers/lima/ir/pp/codegen.c b/src/gallium/drivers/lima/ir/pp/codegen.c
index 6998fbb5287..6f3912d98e2 100644
--- a/src/gallium/drivers/lima/ir/pp/codegen.c
+++ b/src/gallium/drivers/lima/ir/pp/codegen.c
@@ -713,13 +713,13 @@ static int get_instr_encode_size(ppir_instr *instr)
static void bitcopy(void *dst, int dst_offset, void *src, int src_size)
{
- int off1 = dst_offset & 0x1f;
- uint32_t *cpy_dst = dst, *cpy_src = src;
+ unsigned char *cpy_dst = dst, *cpy_src = src;
+ int off1 = dst_offset & 0x07;
- cpy_dst += (dst_offset >> 5);
+ cpy_dst += (dst_offset >> 3);
if (off1) {
- int off2 = 32 - off1;
+ int off2 = 0x08 - off1;
int cpy_size = 0;
while (1) {
*cpy_dst |= *cpy_src << off1;