Open teoet6 opened 9 months ago
0.11.0
const c = @cImport({ @cDefine("STB_IMAGE_IMPLEMENTATION", {}); @cInclude("stb_image.h"); }); pub fn main() !void { var x = @as(i32, undefined); var y = @as(i32, undefined); const data = c.stbi_load("test.png", &x, &y, null, 3); defer c.stbi_image_free(data); }
error: expected type '[4]u8', found 'u8' }).*[@as(c_uint, @intCast(@as(c_int, 2)))] = stbi__get8(s); ~~~~~~~~~~^~~ error: cast increases pointer alignment var y_bytes: __m128i = _mm_loadl_epi64(@as([*c]__m128i, @ptrCast(@volatileCast(@constCast(y + @as(usize, @bitCast(@as(isize, @intCast(i))))))))); ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ note: '[*c]const u8' has alignment '1' var y_bytes: __m128i = _mm_loadl_epi64(@as([*c]__m128i, @ptrCast(@volatileCast(@constCast(y + @as(usize, @bitCast(@as(isize, @intCast(i))))))))); ~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The code to compile.
See https://github.com/ziglang/zig/issues/17302#issuecomment-1737417445 for a workaround.
Zig Version
0.11.0
Steps to Reproduce and Observed Behavior
Expected Behavior
The code to compile.