Skip to content

Commit 9b0d735

Browse files
committed
Dedupe code
1 parent 861c969 commit 9b0d735

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/zemscripten.zig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -111,9 +111,8 @@ pub const EmmallocAllocator = struct {
111111
) ?[*]u8 {
112112
_ = ctx;
113113
_ = return_address;
114-
const ptr_align: u32 = @as(u32, 1) << @intCast(@intFromEnum(ptr_align_log2));
115-
if (!std.math.isPowerOfTwo(ptr_align)) unreachable;
116-
const ptr = emmalloc_memalign(ptr_align, @intCast(len)) orelse return null;
114+
const ptr_align = ptr_align_log2.toByteUnits();
115+
const ptr = emmalloc_memalign(@intCast(ptr_align), @intCast(len)) orelse return null;
117116
return @ptrCast(ptr);
118117
}
119118

0 commit comments

Comments
 (0)