github.com/pidato/unsafe@v0.1.4/memory/hash/le.go (about) 1 //go:build tinygo.wasm || 386 || amd64 || amd64p32 || arm || arm64 || loong64 || mips64le || mips64p32 || mips64p32le || mipsle || ppc64le || riscv || riscv64 || wasm 2 3 package hash 4 5 import ( 6 "unsafe" 7 ) 8 9 func read32(b unsafe.Pointer) uint64 { 10 return uint64(*(*uint32)(b)) 11 } 12 13 func read64(p unsafe.Pointer) uint64 { 14 return *(*uint64)(p) 15 } 16 17 func readUpTo24(p unsafe.Pointer, l uint64) uint64 { 18 return uint64(*(*byte)(p))<<16 | 19 uint64(*(*byte)(unsafe.Add(p, l>>1)))<<8 | 20 uint64(*(*byte)(unsafe.Add(p, l-1))) 21 }