I wonder if there's a way to to the same mathematical operations without having to do a lot of casts, and by casts I'm including creating another variable to hold the same value but with another type too. I think there's just too many casts for a simple operation like this.
This is the zig code: const pixel: u32 = @as(u32, @intFromFloat((@as(f32, @floatFromInt(x)) / @as(f32, @floatFromInt(window.width))) * 255.0)) % 256
The equivalent in C would be: (unsigned) ((float) x / window.width * 255.0f) % 256