Support running WASI (WebAssembly) files using bun run (#1929)

* another micro bench

* Support running WASI

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Jarred Sumner
2023-01-28 23:23:26 -08:00
committed by GitHub
parent 48eb0c12ab
commit f087388ebc
16 changed files with 2407 additions and 28 deletions

View File

@@ -838,6 +838,17 @@ pub inline fn append(allocator: std.mem.Allocator, self: string, other: string)
return buf;
}
pub inline fn append3(allocator: std.mem.Allocator, self: string, other: string, third: string) ![]u8 {
var buf = try allocator.alloc(u8, self.len + other.len + third.len);
if (self.len > 0)
@memcpy(buf.ptr, self.ptr, self.len);
if (other.len > 0)
@memcpy(buf.ptr + self.len, other.ptr, other.len);
if (third.len > 0)
@memcpy(buf.ptr + self.len + other.len, third.ptr, third.len);
return buf;
}
pub inline fn joinBuf(out: []u8, parts: anytype, comptime parts_len: usize) []u8 {
var remain = out;
var count: usize = 0;