diff options
author | 2022-01-01 19:43:42 -0800 | |
---|---|---|
committer | 2022-01-01 19:43:42 -0800 | |
commit | 386ba990bff3ebe6a82f5df891b05b6ddf17024c (patch) | |
tree | 31a974ecd1a0bc27e4b1c8f78fcd00227120e610 /src/memory_allocator.zig | |
parent | 7f1b5c09de5168a5274e0a96f51b393f9a6245a8 (diff) | |
download | bun-386ba990bff3ebe6a82f5df891b05b6ddf17024c.tar.gz bun-386ba990bff3ebe6a82f5df891b05b6ddf17024c.tar.zst bun-386ba990bff3ebe6a82f5df891b05b6ddf17024c.zip |
Fix missing posix_memalign symbol
Diffstat (limited to 'src/memory_allocator.zig')
-rw-r--r-- | src/memory_allocator.zig | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/memory_allocator.zig b/src/memory_allocator.zig index 446c4f13d..a3cd71583 100644 --- a/src/memory_allocator.zig +++ b/src/memory_allocator.zig @@ -8,6 +8,7 @@ const c = struct { pub const malloc_usable_size = mimalloc.mi_malloc_usable_size; pub const malloc = mimalloc.mi_malloc; pub const free = mimalloc.mi_free; + pub const posix_memalign = mimalloc.mi_posix_memalign; }; const Allocator = mem.Allocator; const assert = std.debug.assert; @@ -38,7 +39,7 @@ const CAllocator = struct { pub const supports_malloc_size = false; }; - pub const supports_posix_memalign = @hasDecl(c, "posix_memalign"); + pub const supports_posix_memalign = true; fn getHeader(ptr: [*]u8) *[*]u8 { return @intToPtr(*[*]u8, @ptrToInt(ptr) - @sizeOf(usize)); @@ -48,7 +49,7 @@ const CAllocator = struct { if (supports_posix_memalign) { // The posix_memalign only accepts alignment values that are a // multiple of the pointer size - const eff_alignment = std.math.max(alignment, @sizeOf(usize)); + const eff_alignment = @maximum(alignment, @sizeOf(usize)); var aligned_ptr: ?*anyopaque = undefined; if (c.posix_memalign(&aligned_ptr, eff_alignment, len) != 0) |