Make hash procedures contextless where possible

This commit is contained in:
gingerBill
2024-03-27 12:54:37 +00:00
parent 3bc7c51325
commit 6422c090f2
4 changed files with 22 additions and 22 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ package hash
import "base:intrinsics"
@(optimization_mode="speed")
crc32 :: proc(data: []byte, seed := u32(0)) -> u32 #no_bounds_check {
crc32 :: proc "contextless" (data: []byte, seed := u32(0)) -> u32 #no_bounds_check {
crc := ~seed
buffer := raw_data(data)
length := len(data)
@@ -323,7 +323,7 @@ crc32_table := [8][256]u32{
/*
@(optimization_mode="speed")
crc32 :: proc(data: []byte, seed := u32(0)) -> u32 {
crc32 :: proc "contextless" (data: []byte, seed := u32(0)) -> u32 {
result := ~u32(seed);
#no_bounds_check for b in data {
result = result>>8 ~ _crc32_table[(result ~ u32(b)) & 0xff];