diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin index 4f3488eb7..96944c7f2 100644 --- a/core/runtime/internal.odin +++ b/core/runtime/internal.odin @@ -177,8 +177,70 @@ mem_resize :: #force_inline proc(ptr: rawptr, old_size, new_size: int, alignment new_ptr = raw_data(new_data) return } -memory_equal :: proc "contextless" (a, b: rawptr, n: int) -> bool { - return memory_compare(a, b, n) == 0 +memory_equal :: proc "contextless" (x, y: rawptr, n: int) -> bool { + switch { + case n == 0: return true + case x == y: return true + } + + a, b := ([^]byte)(x), ([^]byte)(y) + length := uint(n) + + when size_of(uint) == 8 { + if word_length := length >> 3; word_length != 0 { + for i in 0..> 2; word_length != 0 { + for i in 0.. int #no_bounds_check { switch { @@ -261,69 +323,10 @@ memory_compare_zero :: proc "contextless" (a: rawptr, n: int) -> int #no_bounds_ string_eq :: proc "contextless" (lhs, rhs: string) -> bool { x := transmute(Raw_String)lhs y := transmute(Raw_String)rhs - switch { - case x.len != y.len: return false - case x.len == 0: return true - case x.data == y.data: return true - } - - a, b := x.data, y.data - length := uint(x.len) - - when size_of(uint) == 8 { - if word_length := length >> 3; word_length != 0 { - for i in 0..> 2; word_length != 0 { - for i in 0.. int {