diff options
author | 2022-12-05 17:14:06 -0800 | |
---|---|---|
committer | 2022-12-05 17:14:29 -0800 | |
commit | c7f411bd88bf9443f1133b2c24fd018250f80541 (patch) | |
tree | 6439111813b1705d2d6985bf715b3c69bfdf5bd1 | |
parent | 60e6a47bb07b0f98eed3dd6fb3c9e160a45dae54 (diff) | |
download | bun-c7f411bd88bf9443f1133b2c24fd018250f80541.tar.gz bun-c7f411bd88bf9443f1133b2c24fd018250f80541.tar.zst bun-c7f411bd88bf9443f1133b2c24fd018250f80541.zip |
Use more simdutf
Diffstat (limited to '')
-rw-r--r-- | src/string_immutable.zig | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig index 6ea880522..38b11a5d5 100644 --- a/src/string_immutable.zig +++ b/src/string_immutable.zig @@ -2764,6 +2764,15 @@ pub fn firstNonASCII(slice: []const u8) ?u32 { pub fn firstNonASCIIWithType(comptime Type: type, slice: Type) ?u32 { var remaining = slice; + if (comptime bun.FeatureFlags.use_simdutf) { + const result = bun.simdutf.validate.with_errors.ascii(slice); + if (result.status == .success) { + return null; + } + + return @truncate(u32, result.count); + } + if (comptime Environment.enableSIMD) { if (remaining.len >= ascii_vector_size) { const remaining_start = remaining.ptr; |