aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgingerBill <gingerBill@users.noreply.github.com>2024-05-25 21:48:31 +0100
committerGitHub <noreply@github.com>2024-05-25 21:48:31 +0100
commitef7a155f9ad7b8377428ec5538d776c9cdef5bd6 (patch)
tree340e928aeab65badda1ce4541a10c6a697ac824f
parentcfadca04f9b773d34e637bdb31e94cd1656d3095 (diff)
parent58ae96c821e4589ac0789f6c1e7f9ead67d73fb7 (diff)
Merge pull request #3633 from korvahkh/fix-slice-has-affix
Fix slice.has_prefix & slice.has_suffix
-rw-r--r--core/slice/slice.odin4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/slice/slice.odin b/core/slice/slice.odin
index 03791e7dd..3cab9189d 100644
--- a/core/slice/slice.odin
+++ b/core/slice/slice.odin
@@ -222,7 +222,7 @@ prefix_length :: proc(a, b: $T/[]$E) -> (n: int) where intrinsics.type_is_compar
}
@(require_results)
-has_prefix :: proc(array: $T/[]$E, needle: E) -> bool where intrinsics.type_is_comparable(E) {
+has_prefix :: proc(array: $T/[]$E, needle: T) -> bool where intrinsics.type_is_comparable(E) {
n := len(needle)
if len(array) >= n {
return equal(array[:n], needle)
@@ -232,7 +232,7 @@ has_prefix :: proc(array: $T/[]$E, needle: E) -> bool where intrinsics.type_is_c
@(require_results)
-has_suffix :: proc(array: $T/[]$E, needle: E) -> bool where intrinsics.type_is_comparable(E) {
+has_suffix :: proc(array: $T/[]$E, needle: T) -> bool where intrinsics.type_is_comparable(E) {
array := array
m, n := len(array), len(needle)
if m >= n {