aboutsummaryrefslogtreecommitdiff
path: root/src/exact_size_matcher.zig
diff options
context:
space:
mode:
authorGravatar Jarred Sumner <jarred@jarredsumner.com> 2023-07-11 19:14:34 -0700
committerGravatar GitHub <noreply@github.com> 2023-07-11 19:14:34 -0700
commitcbb88672f217a90db1aa1eb29cd92d5d9035b22b (patch)
tree43a00501f3cde495967e116f0b660777051551f8 /src/exact_size_matcher.zig
parent1f900cff453700b19bca2acadfe26da4468c1282 (diff)
parent34b0e7a2bbd8bf8097341cdb0075d0908283e834 (diff)
downloadbun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.gz
bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.tar.zst
bun-cbb88672f217a90db1aa1eb29cd92d5d9035b22b.zip
Merge branch 'main' into jarred/esm-conditionsjarred/esm-conditions
Diffstat (limited to 'src/exact_size_matcher.zig')
-rw-r--r--src/exact_size_matcher.zig11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/exact_size_matcher.zig b/src/exact_size_matcher.zig
index 5d47cee98..67d0b8fe8 100644
--- a/src/exact_size_matcher.zig
+++ b/src/exact_size_matcher.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const bun = @import("root").bun;
pub fn ExactSizeMatcher(comptime max_bytes: usize) type {
switch (max_bytes) {
@@ -19,11 +20,11 @@ pub fn ExactSizeMatcher(comptime max_bytes: usize) type {
1...max_bytes - 1 => {
var tmp: [max_bytes]u8 = undefined;
if (comptime std.meta.trait.isSlice(@TypeOf(str))) {
- @memcpy(&tmp, str.ptr, str.len);
- @memset(tmp[str.len..].ptr, 0, tmp[str.len..].len);
+ @memcpy(tmp[0..str.len], str);
+ @memset(tmp[str.len..], 0);
} else {
- @memcpy(&tmp, str, str.len);
- @memset(tmp[str.len..], 0, tmp[str.len..].len);
+ @memcpy(tmp[0..str.len], str);
+ @memset(tmp[str.len..], 0);
}
return std.mem.readIntNative(T, &tmp);
@@ -47,7 +48,7 @@ pub fn ExactSizeMatcher(comptime max_bytes: usize) type {
for (str, 0..) |char, i| {
tmp[i] = std.ascii.toLower(char);
}
- @memset(tmp[str.len..].ptr, 0, tmp[str.len..].len);
+ @memset(tmp[str.len..], 0);
return std.mem.readIntNative(T, &tmp);
},
max_bytes => {