unsafe_disabled.go raw

   1  //go:build !(amd64 || arm64 || ppc64le || riscv64) || nounsafe || purego || appengine
   2  
   3  package le
   4  
   5  import (
   6  	"encoding/binary"
   7  )
   8  
   9  // Load8 will load from b at index i.
  10  func Load8[I Indexer](b []byte, i I) byte {
  11  	return b[i]
  12  }
  13  
  14  // Load16 will load from b at index i.
  15  func Load16[I Indexer](b []byte, i I) uint16 {
  16  	return binary.LittleEndian.Uint16(b[i:])
  17  }
  18  
  19  // Load32 will load from b at index i.
  20  func Load32[I Indexer](b []byte, i I) uint32 {
  21  	return binary.LittleEndian.Uint32(b[i:])
  22  }
  23  
  24  // Load64 will load from b at index i.
  25  func Load64[I Indexer](b []byte, i I) uint64 {
  26  	return binary.LittleEndian.Uint64(b[i:])
  27  }
  28  
  29  // Store16 will store v at b.
  30  func Store16(b []byte, v uint16) {
  31  	binary.LittleEndian.PutUint16(b, v)
  32  }
  33  
  34  // Store32 will store v at b.
  35  func Store32(b []byte, v uint32) {
  36  	binary.LittleEndian.PutUint32(b, v)
  37  }
  38  
  39  // Store64 will store v at b.
  40  func Store64[I Indexer](b []byte, i I, v uint64) {
  41  	binary.LittleEndian.PutUint64(b[i:], v)
  42  }
  43