| ... | @@ -326,9 +326,6 @@ pub fn resize(self: Allocator, allocation: anytype, new_len: usize) bool { | ... | @@ -326,9 +326,6 @@ pub fn resize(self: Allocator, allocation: anytype, new_len: usize) bool { |
| 326 | return false; | 326 | return false; |
| 327 | } | 327 | } |
| 328 | const old_memory: []u8 = @ptrCast(@constCast(mem.absorbSentinel(allocation))); | 328 | const old_memory: []u8 = @ptrCast(@constCast(mem.absorbSentinel(allocation))); |
| 329 | // I would like to use saturating multiplication here, but LLVM cannot lower it | | |
| 330 | // on WebAssembly: https://github.com/ziglang/zig/issues/9660 | | |
| 331 | //const new_len_bytes = new_len *| @sizeOf(T); | | |
| 332 | const new_len_bytes = math.mul(usize, @sizeOf(T), new_len) catch return false; | 329 | const new_len_bytes = math.mul(usize, @sizeOf(T), new_len) catch return false; |
| 333 | return self.rawResize( | 330 | return self.rawResize( |
| 334 | old_memory, | 331 | old_memory, |
| ... | @@ -372,9 +369,6 @@ pub fn remap(self: Allocator, allocation: anytype, new_len: usize) ?@TypeOf(allo | ... | @@ -372,9 +369,6 @@ pub fn remap(self: Allocator, allocation: anytype, new_len: usize) ?@TypeOf(allo |
| 372 | return new_memory; | 369 | return new_memory; |
| 373 | } | 370 | } |
| 374 | const old_memory: []u8 = @ptrCast(@constCast(mem.absorbSentinel(allocation))); | 371 | const old_memory: []u8 = @ptrCast(@constCast(mem.absorbSentinel(allocation))); |
| 375 | // I would like to use saturating multiplication here, but LLVM cannot lower it | | |
| 376 | // on WebAssembly: https://github.com/ziglang/zig/issues/9660 | | |
| 377 | //const new_len_bytes = new_len *| @sizeOf(T); | | |
| 378 | const new_len_bytes = math.mul(usize, @sizeOf(T), new_len) catch return null; | 372 | const new_len_bytes = math.mul(usize, @sizeOf(T), new_len) catch return null; |
| 379 | const new_ptr = self.rawRemap( | 373 | const new_ptr = self.rawRemap( |
| 380 | old_memory, | 374 | old_memory, |