| ... | @@ -282,11 +282,9 @@ pub fn reallocAdvanced( | ... | @@ -282,11 +282,9 @@ pub fn reallocAdvanced( |
| 282 | const old_byte_slice = mem.sliceAsBytes(old_mem); | 282 | const old_byte_slice = mem.sliceAsBytes(old_mem); |
| 283 | const byte_count = math.mul(usize, @sizeOf(T), new_n) catch return Error.OutOfMemory; | 283 | const byte_count = math.mul(usize, @sizeOf(T), new_n) catch return Error.OutOfMemory; |
| 284 | // Note: can't set shrunk memory to undefined as memory shouldn't be modified on realloc failure | 284 | // Note: can't set shrunk memory to undefined as memory shouldn't be modified on realloc failure |
| 285 | if (mem.isAligned(@intFromPtr(old_byte_slice.ptr), Slice.alignment)) { | 285 | if (self.rawResize(old_byte_slice, log2a(Slice.alignment), byte_count, return_address)) { |
| 286 | if (self.rawResize(old_byte_slice, log2a(Slice.alignment), byte_count, return_address)) { | 286 | const new_bytes: []align(Slice.alignment) u8 = @alignCast(old_byte_slice.ptr[0..byte_count]); |
| 287 | const new_bytes: []align(Slice.alignment) u8 = @alignCast(old_byte_slice.ptr[0..byte_count]); | 287 | return mem.bytesAsSlice(T, new_bytes); |
| 288 | return mem.bytesAsSlice(T, new_bytes); | | |
| 289 | } | | |
| 290 | } | 288 | } |
| 291 | | 289 | |
| 292 | const new_mem = self.rawAlloc(byte_count, log2a(Slice.alignment), return_address) orelse | 290 | const new_mem = self.rawAlloc(byte_count, log2a(Slice.alignment), return_address) orelse |