zig
zig copied to clipboard
Vector type resolution/coercion fixes
Peer type resolution for vectors
This is consistent with how coercion for vectors work. So now you can do this:
var a: @Vector(2, u16) = .{1, 2};
var b: @Vector(2, u8) = .{2, 1};
const c = @min(a, b);
where previously you had to cast explicitly:
var a: @Vector(2, u16) = .{1, 2};
var b: @Vector(2, u8) = .{2, 1};
var c: @Vector(2, u16) = b;
const c = @min(a, c);
Fix result pointer coercion array -> vector
Previously this worked for array to vector where the element type matched exactly (e.g [4]u8
to @Vector(4, u8)
) since that is performed with a simple .bitcast
operation, but now it also works for types where the array is coercible to the vector type (e.g [4]u8
to @Vector(4, u16)
).