From 0f9756f4808739c8b18e62e28bdbb430af735c67 Mon Sep 17 00:00:00 2001 From: Erico Nunes Date: Sat, 5 Feb 2022 11:14:36 +0100 Subject: [PATCH] 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 Reviewed-by: Vasily Khoruzhick Cc: 22.0 Part-of: --- src/gallium/drivers/lima/ir/pp/codegen.c | 8 ++++---- 1 file 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;