std: eradicate u29 and embrace std.mem.Alignment

This commit is contained in:
Andrew Kelley
2025-04-11 17:55:25 -07:00
parent ec28888581
commit f32a5d349d
32 changed files with 153 additions and 156 deletions

View File

@@ -350,11 +350,7 @@ pub fn MultiArrayList(comptime T: type) type {
assert(new_len <= self.capacity);
assert(new_len <= self.len);
const other_bytes = gpa.alignedAlloc(
u8,
@alignOf(Elem),
capacityInBytes(new_len),
) catch {
const other_bytes = gpa.alignedAlloc(u8, .of(Elem), capacityInBytes(new_len)) catch {
const self_slice = self.slice();
inline for (fields, 0..) |field_info, i| {
if (@sizeOf(field_info.type) != 0) {
@@ -440,11 +436,7 @@ pub fn MultiArrayList(comptime T: type) type {
/// `new_capacity` must be greater or equal to `len`.
pub fn setCapacity(self: *Self, gpa: Allocator, new_capacity: usize) !void {
assert(new_capacity >= self.len);
const new_bytes = try gpa.alignedAlloc(
u8,
@alignOf(Elem),
capacityInBytes(new_capacity),
);
const new_bytes = try gpa.alignedAlloc(u8, .of(Elem), capacityInBytes(new_capacity));
if (self.len == 0) {
gpa.free(self.allocatedBytes());
self.bytes = new_bytes.ptr;