misc changes

This commit is contained in:
2025-01-03 13:06:05 -05:00
parent db1701a5d7
commit 8c7b3e2058
5 changed files with 59 additions and 4 deletions

5
code/grime/hashing.odin Normal file
View File

@ -0,0 +1,5 @@
package grime
djb8_hash :: #force_inline proc "contextless" ( hash : ^u64, bytes : []byte ) {
for value in bytes do (hash^) = (( (hash^) << 8) + (hash^) ) + u64(value)
}

View File

@ -94,4 +94,8 @@ memory_aign_forward :: #force_inline proc( address, alignment : uintptr) -> uint
//endregion Memory Math
swap :: #force_inline proc( a, b : ^ $Type ) -> ( ^ Type, ^ Type ) { return b, a }
swap :: #force_inline proc "contextless" ( a, b : ^ $Type ) -> ( ^ Type, ^ Type ) { return b, a }
to_bytes :: #force_inline proc "contextless" ( typed_block : ^$Type ) -> []byte {
return slice_ptr( transmute(^byte) typed_block, size_of(Type) )
}