fix list decref

This commit is contained in:
Folkert 2021-09-10 21:53:57 +02:00
parent 5e68d31afc
commit cd9b32ba65
4 changed files with 27 additions and 22 deletions

View file

@ -118,11 +118,12 @@ pub fn decrefC(
}
pub fn decrefCheckNullC(
bytes_or_null: ?[*]isize,
bytes_or_null: ?[*]u8,
alignment: u32,
) callconv(.C) void {
if (bytes_or_null) |bytes| {
return @call(.{ .modifier = always_inline }, decref_ptr_to_refcount, .{ bytes, alignment });
const isizes: [*]isize = @ptrCast([*]isize, @alignCast(@sizeOf(isize), bytes));
return @call(.{ .modifier = always_inline }, decref_ptr_to_refcount, .{ isizes - 1, alignment });
}
}