github.com/zhangyunhao116/wyhash@v0.4.1-0.20220217162229-7d42996fa899/internal/unalign/readunaligned_little.go (about)

     1  // +build ppc64 s390x mips mips64
     2  //
     3  // from golang-go/src/os/endian_little.go
     4  
     5  package unalign
     6  
     7  import (
     8  	"unsafe"
     9  )
    10  
    11  func Read8(p unsafe.Pointer) uint64 {
    12  	q := (*[8]byte)(p)
    13  	return uint64(q[7]) | uint64(q[6])<<8 | uint64(q[5])<<16 | uint64(q[4])<<24 |
    14  		uint64(q[3])<<32 | uint64(q[2])<<40 | uint64(q[1])<<48 | uint64(q[0])<<56
    15  }
    16  
    17  func Read4(p unsafe.Pointer) uint64 {
    18  	q := (*[4]byte)(p)
    19  	return uint64(uint32(q[3]) | uint32(q[2])<<8 | uint32(q[1])<<16 | uint32(q[0])<<24)
    20  }