zigzap / zap

blazingly fast backends in zig
MIT License
2.23k stars 75 forks source link

Update to use the new alignCast where the alignOf is not needed anymore #28

Closed edyu closed 1 year ago

edyu commented 1 year ago

Once again, for readability's sake, the Zig api changed again: Basically, @as(A, @ptrCast(@alignCast(@alignOf(A), B)))) is changed to @as(A, @ptrCast(@alignCast(B))). And some other changes to @intCast, @bitCast, @truncate such as the following: old

return ((((__bsx & @as(c_uint, 4278190080)) >> @intCast(@import("std").math.Log2Int(c_uint), 24)) | ((__bsx & @as(c_uint, 16711680)) >> @intCast(@import("std").math.Log2Int(c_uint), 8))) | ((__bsx & @as(c_uint, 65280)) << @intCast(@import("std").math.Log2Int(c_uint), 8))) | ((__bsx & @as(c_uint, 255)) << @intCast(@import("std").math.Log2Int(c_uint), 24));

new

return ((((__bsx & @as(c_uint, 4278190080)) >> @as(@import("std").math.Log2Int(c_uint), @intCast(24))) | ((__bsx & @as(c_uint, 16711680)) >> @as(@import("std").math.Log2Int(c_uint), @intCast(8)))) | ((__bsx & @as(c_uint, 65280)) << @as(@import("std").math.Log2Int(c_uint), @intCast(8)))) | ((__bsx & @as(c_uint, 255)) << @as(@import("std").math.Log2Int(c_uint), @intCast(24)));
renerocksai commented 1 year ago

I trust you, so I'll merge!