Fix $$str_hash to use a5hash like String.hash() (#2403)

* Fix `$$str_hash` to use `a5hash` like `String.hash()`
This commit is contained in:
Zack Puhl
2025-08-14 14:24:01 -04:00
committed by GitHub
parent 85dc9c45ab
commit eb8fb8871f
6 changed files with 94 additions and 3 deletions

View File

@@ -57,6 +57,6 @@ entry:
call void @llvm.memcpy.p0.p0.i32(ptr align 16 %e, ptr align 16 @.__const.7, i32 32, i1 false)
store %"char[]" { ptr @.emptystr, i64 0 }, ptr %f, align 8
store %"char[]" { ptr @.str.8, i64 3 }, ptr %g, align 8
store i32 1000299617, ptr %h, align 4
store i32 -1151103613, ptr %h, align 4
ret i32 0
}

View File

@@ -6,6 +6,6 @@ fn int main()
$assert(@str_lower("Hello World") == "hello world");
$assert(@str_find("Hello World", "o") == 4);
$assert(@str_find("Hello World", "w") == -1);
$assert(@str_hash("Hello C3") == 487972447);
$assert(@str_hash("Hello C3") == 2193775821);
return 0;
}