0
Fork 0
mirror of https://codeberg.org/ziglang/zig synced 2026-11-18 07:05:05 +00:00
zig/test/behavior/vector.zig
Frank Denis 09ee89a89c cbe: Fix @reduce(.Add) and @reduce(.Mul) with narrow integers
For integers up to 64 bits, the generated code used += and *=,
but the C type might be bigger than the Zig type.

For example, a sum or product of u1, u7 or i3 integers would end
up out of range.

Fix this by using zig_addw and zig_mulw if the integer bit width
doesn't match the C type.
2026-10-24 23:04:43 +02:00

1842 lines
76 KiB