authorgravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-05-06 20:48:44 -07:00
committergravatar for hello@nektro.netMeghan Denny <hello@nektro.net> 2022-05-06 20:48:44 -07:00
log596432af98c7cfd04047b9c885871e0237d34bed
tree13aa6a98eeb2917ae47daf80761bad0420bb9669
parent13f985e368b9ff32f972282fe41faad2d60b6670

add ptrCast


1 files changed, 4 insertions(+), 0 deletions(-)

src/lib.zig+4
......@@ -241,3 +241,7 @@ pub fn countScalar(comptime T: type, haystack: []const T, needle: T) usize {
241241 }
242242 return found;
243243}
244
245pub fn ptrCast(comptime T: type, ptr: *anyopaque) *T {
246 return @ptrCast(*T, @alignCast(@alignOf(T), ptr));
247}