Add alignment feature flag

This commit is contained in:
Jarred Sumner
2023-05-07 01:04:38 -07:00
parent 25eecc3e07
commit 243847f992
3 changed files with 10 additions and 0 deletions

View File

@@ -79,6 +79,10 @@ const CAllocator = struct {
}
fn alloc(_: *anyopaque, len: usize, log2_align: u8, _: usize) ?[*]u8 {
if (comptime FeatureFlags.alignment_tweak) {
return alignedAlloc(len, log2_align);
}
const alignment = @as(usize, 1) << @intCast(Allocator.Log2Align, log2_align);
return alignedAlloc(len, alignment);
}