diff options
author | 2021-08-17 04:09:55 -0700 | |
---|---|---|
committer | 2021-08-17 04:09:55 -0700 | |
commit | 1e81d4d2a907394d2593d1f51023410ea0d5fbda (patch) | |
tree | 139db7e910004f063a4e8131f7578f8e1c146af8 | |
parent | 71943a83e6173ec73d958c27c5ac9e305d253fb4 (diff) | |
download | bun-1e81d4d2a907394d2593d1f51023410ea0d5fbda.tar.gz bun-1e81d4d2a907394d2593d1f51023410ea0d5fbda.tar.zst bun-1e81d4d2a907394d2593d1f51023410ea0d5fbda.zip |
fix endsWith
Former-commit-id: 5d89343b0bd923fd7400770d25b12985eb937f70
-rw-r--r-- | src/string_immutable.zig | 15 |
1 files changed, 2 insertions, 13 deletions
diff --git a/src/string_immutable.zig b/src/string_immutable.zig index 618657a64..caeb8bea9 100644 --- a/src/string_immutable.zig +++ b/src/string_immutable.zig @@ -52,19 +52,8 @@ pub fn startsWith(self: string, str: string) bool { return true; } -pub fn endsWith(self: string, str: string) bool { - if (str.len > self.len) { - return false; - } - - var i: usize = str.len - 1; - while (i > 0) : (i -= 1) { - if (str[i] != self[i]) { - return false; - } - } - - return true; +pub inline fn endsWith(self: string, str: string) bool { + return @call(.{ .modifier = .always_inline }, std.mem.endsWith, .{ u8, self, str }); } pub fn endsWithAny(self: string, str: string) bool { |