implement foldhash implement hashmap squash & log some more bugs clean up Target & Config interfaces add rudimentary math functions extract allocators to new directory implement vec.get_ref fix capitalisation document some of lily's type spec
901 B
901 B
hashers
- hashers must not allocate on the heap.
- all spec compliant hashers should implement:
unless otherwise stated, functions can be optionally inline.
names of arguments are up to programmer discretion.
names and signature of functions must be identical to shown below.
Hasher := struct {
new := fn(seed: SeedType): Self
/// prepare to be deallocated
deinit := fn(self: ^Self): void
/// should always use a constant or randomised seed
/// randomised seeds should (for now) use lily.Target.getrandom()
/// never use values from the environment
default := fn(): Self
/// pointers: treat as uint
/// slices: read bytes and hash
/// other: hash bytes directly
write := fn(self: ^Self, any: @Any()): void
/// should not reset the state of the hasher
finish := fn(self: ^Self): uint
reset := fn(self: ^Self): void
}