mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-11-21 17:34:59 +00:00
target/riscv/vector_helper: Fix build on 32-bit big endian hosts
The code currently fails to compile on 32-bit big endian hosts:
target/riscv/vector_helper.c: In function 'vext_clear':
target/riscv/vector_helper.c:154:16: error: cast to pointer from integer
of different size [-Werror=int-to-pointer-cast]
memset((void *)((uintptr_t)tail & ~(7ULL)), 0, part1);
^
target/riscv/vector_helper.c:155:16: error: cast to pointer from integer
of different size [-Werror=int-to-pointer-cast]
memset((void *)(((uintptr_t)tail + 8) & ~(7ULL)), 0, part2);
^
cc1: all warnings being treated as errors
We should not use "long long" (i.e. 64-bit) values here to avoid the
problem. Switch to our QEMU_ALIGN_PTR_DOWN/UP macros instead.
Backports 35c7f5254b608c0694b11fc9f0d2c1a4ffb216b4
This commit is contained in:
parent
0f95c05ca4
commit
1a4d0973f0
|
|
@ -152,8 +152,8 @@ static void vext_clear(void *tail, uint32_t cnt, uint32_t tot)
|
||||||
if (cnt % 8) {
|
if (cnt % 8) {
|
||||||
part1 = 8 - (cnt % 8);
|
part1 = 8 - (cnt % 8);
|
||||||
part2 = tot - cnt - part1;
|
part2 = tot - cnt - part1;
|
||||||
memset((void *)((uintptr_t)tail & ~(7ULL)), 0, part1);
|
memset(QEMU_ALIGN_PTR_DOWN(tail, 8), 0, part1);
|
||||||
memset((void *)(((uintptr_t)tail + 8) & ~(7ULL)), 0, part2);
|
memset(QEMU_ALIGN_PTR_UP(tail, 8), 0, part2);
|
||||||
} else {
|
} else {
|
||||||
memset(tail, 0, part2);
|
memset(tail, 0, part2);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue