diff --git a/.zigversion b/.zigversion index a803cc2..8c5723d 100644 --- a/.zigversion +++ b/.zigversion @@ -1 +1 @@ -0.14.0 +0.15.0-dev diff --git a/build.zig.zon b/build.zig.zon index 1acc81d..65dd34e 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -2,7 +2,7 @@ .name = .zstbi, .fingerprint = 0x3c971054ff1a412f, .version = "0.11.0-dev", - .minimum_zig_version = "0.13.0-dev.351+64ef45eb0", + .minimum_zig_version = "0.15.0-dev.552+bc2f7c754", .paths = .{ "build.zig", "build.zig.zon", diff --git a/src/zstbi.zig b/src/zstbi.zig index b0908f7..6a68886 100644 --- a/src/zstbi.zig +++ b/src/zstbi.zig @@ -380,7 +380,7 @@ pub fn setFlipVerticallyOnWrite(should_flip: bool) void { var mem_allocator: ?std.mem.Allocator = null; var mem_allocations: ?std.AutoHashMap(usize, usize) = null; var mem_mutex: std.Thread.Mutex = .{}; -const mem_alignment = 16; +const mem_alignment = std.mem.Alignment.@"16"; extern var zstbiMallocPtr: ?*const fn (size: usize) callconv(.C) ?*anyopaque; extern var zstbiwMallocPtr: ?*const fn (size: usize) callconv(.C) ?*anyopaque; @@ -409,9 +409,9 @@ fn zstbiRealloc(ptr: ?*anyopaque, size: usize) callconv(.C) ?*anyopaque { const old_size = if (ptr != null) mem_allocations.?.get(@intFromPtr(ptr.?)).? else 0; const old_mem = if (old_size > 0) - @as([*]align(mem_alignment) u8, @ptrCast(@alignCast(ptr)))[0..old_size] + @as([*]align(mem_alignment.toByteUnits()) u8, @ptrCast(@alignCast(ptr)))[0..old_size] else - @as([*]align(mem_alignment) u8, undefined)[0..0]; + @as([*]align(mem_alignment.toByteUnits()) u8, undefined)[0..0]; const new_mem = mem_allocator.?.realloc(old_mem, size) catch @panic("zstbi: out of memory"); @@ -434,7 +434,7 @@ fn zstbiFree(maybe_ptr: ?*anyopaque) callconv(.C) void { defer mem_mutex.unlock(); const size = mem_allocations.?.fetchRemove(@intFromPtr(ptr)).?.value; - const mem = @as([*]align(mem_alignment) u8, @ptrCast(@alignCast(ptr)))[0..size]; + const mem = @as([*]align(mem_alignment.toByteUnits()) u8, @ptrCast(@alignCast(ptr)))[0..size]; mem_allocator.?.free(mem); } }