// budgeting system does not see that. See issue 42958.
if base.Ctxt.Arch.CanMergeLoads && name.Sym().Pkg.Path == "internal/byteorder" {
switch name.Sym().Name {
- case "LeUint64", "LeUint32", "LeUint16",
- "BeUint64", "BeUint32", "BeUint16",
- "LePutUint64", "LePutUint32", "LePutUint16",
- "BePutUint64", "BePutUint32", "BePutUint16",
- "LeAppendUint64", "LeAppendUint32", "LeAppendUint16",
- "BeAppendUint64", "BeAppendUint32", "BeAppendUint16":
+ case "LEUint64", "LEUint32", "LEUint16",
+ "BEUint64", "BEUint32", "BEUint16",
+ "LEPutUint64", "LEPutUint32", "LEPutUint16",
+ "BEPutUint64", "BEPutUint32", "BEPutUint16",
+ "LEAppendUint64", "LEAppendUint32", "LEAppendUint16",
+ "BEAppendUint64", "BEAppendUint32", "BEAppendUint16":
cheap = true
}
}
counter[gcmBlockSize-1] = 1
} else {
lenBlock := make([]byte, 16)
- byteorder.BePutUint64(lenBlock[8:], uint64(len(nonce))*8)
+ byteorder.BEPutUint64(lenBlock[8:], uint64(len(nonce))*8)
J := gcm.GHASH(H, nonce, lenBlock)
copy(counter[:], J)
}
func gcmInc32(counterBlock *[gcmBlockSize]byte) {
ctr := counterBlock[len(counterBlock)-4:]
- byteorder.BePutUint32(ctr, byteorder.BeUint32(ctr)+1)
+ byteorder.BEPutUint32(ctr, byteorder.BEUint32(ctr)+1)
}
func gcmAuth(out []byte, H, tagMask *[gcmBlockSize]byte, ciphertext, additionalData []byte) {
lenBlock := make([]byte, 16)
- byteorder.BePutUint64(lenBlock[:8], uint64(len(additionalData))*8)
- byteorder.BePutUint64(lenBlock[8:], uint64(len(ciphertext))*8)
+ byteorder.BEPutUint64(lenBlock[:8], uint64(len(additionalData))*8)
+ byteorder.BEPutUint64(lenBlock[8:], uint64(len(ciphertext))*8)
S := gcm.GHASH(H, additionalData, ciphertext, lenBlock)
subtle.XORBytes(out, S, tagMask[:])
}
)
func cryptBlock(subkeys []uint64, dst, src []byte, decrypt bool) {
- b := byteorder.BeUint64(src)
+ b := byteorder.BEUint64(src)
b = permuteInitialBlock(b)
left, right := uint32(b>>32), uint32(b)
// switch left & right and perform final permutation
preOutput := (uint64(right) << 32) | uint64(left)
- byteorder.BePutUint64(dst, permuteFinalBlock(preOutput))
+ byteorder.BEPutUint64(dst, permuteFinalBlock(preOutput))
}
// DES Feistel function. feistelBox must be initialized via
feistelBoxOnce.Do(initFeistelBox)
// apply PC1 permutation to key
- key := byteorder.BeUint64(keyBytes)
+ key := byteorder.BEUint64(keyBytes)
permutedKey := permuteBlock(key, permutedChoice1[:])
// rotate halves of permuted key according to the rotation schedule
panic("crypto/des: invalid buffer overlap")
}
- b := byteorder.BeUint64(src)
+ b := byteorder.BEUint64(src)
b = permuteInitialBlock(b)
left, right := uint32(b>>32), uint32(b)
right = (right << 31) | (right >> 1)
preOutput := (uint64(right) << 32) | uint64(left)
- byteorder.BePutUint64(dst, permuteFinalBlock(preOutput))
+ byteorder.BEPutUint64(dst, permuteFinalBlock(preOutput))
}
func (c *tripleDESCipher) Decrypt(dst, src []byte) {
panic("crypto/des: invalid buffer overlap")
}
- b := byteorder.BeUint64(src)
+ b := byteorder.BEUint64(src)
b = permuteInitialBlock(b)
left, right := uint32(b>>32), uint32(b)
right = (right << 31) | (right >> 1)
preOutput := (uint64(right) << 32) | uint64(left)
- byteorder.BePutUint64(dst, permuteFinalBlock(preOutput))
+ byteorder.BEPutUint64(dst, permuteFinalBlock(preOutput))
}
func (h *sha1Hash) AppendBinary(b []byte) ([]byte, error) {
d := (*sha1Ctx)(unsafe.Pointer(&h.ctx))
b = append(b, sha1Magic...)
- b = byteorder.BeAppendUint32(b, d.h[0])
- b = byteorder.BeAppendUint32(b, d.h[1])
- b = byteorder.BeAppendUint32(b, d.h[2])
- b = byteorder.BeAppendUint32(b, d.h[3])
- b = byteorder.BeAppendUint32(b, d.h[4])
+ b = byteorder.BEAppendUint32(b, d.h[0])
+ b = byteorder.BEAppendUint32(b, d.h[1])
+ b = byteorder.BEAppendUint32(b, d.h[2])
+ b = byteorder.BEAppendUint32(b, d.h[3])
+ b = byteorder.BEAppendUint32(b, d.h[4])
b = append(b, d.x[:d.nx]...)
b = append(b, make([]byte, len(d.x)-int(d.nx))...)
- b = byteorder.BeAppendUint64(b, uint64(d.nl)>>3|uint64(d.nh)<<29)
+ b = byteorder.BEAppendUint64(b, uint64(d.nl)>>3|uint64(d.nh)<<29)
return b, nil
}
func (h *sha224Hash) AppendBinary(b []byte) ([]byte, error) {
d := (*sha256Ctx)(unsafe.Pointer(&h.ctx))
b = append(b, magic224...)
- b = byteorder.BeAppendUint32(b, d.h[0])
- b = byteorder.BeAppendUint32(b, d.h[1])
- b = byteorder.BeAppendUint32(b, d.h[2])
- b = byteorder.BeAppendUint32(b, d.h[3])
- b = byteorder.BeAppendUint32(b, d.h[4])
- b = byteorder.BeAppendUint32(b, d.h[5])
- b = byteorder.BeAppendUint32(b, d.h[6])
- b = byteorder.BeAppendUint32(b, d.h[7])
+ b = byteorder.BEAppendUint32(b, d.h[0])
+ b = byteorder.BEAppendUint32(b, d.h[1])
+ b = byteorder.BEAppendUint32(b, d.h[2])
+ b = byteorder.BEAppendUint32(b, d.h[3])
+ b = byteorder.BEAppendUint32(b, d.h[4])
+ b = byteorder.BEAppendUint32(b, d.h[5])
+ b = byteorder.BEAppendUint32(b, d.h[6])
+ b = byteorder.BEAppendUint32(b, d.h[7])
b = append(b, d.x[:d.nx]...)
b = append(b, make([]byte, len(d.x)-int(d.nx))...)
- b = byteorder.BeAppendUint64(b, uint64(d.nl)>>3|uint64(d.nh)<<29)
+ b = byteorder.BEAppendUint64(b, uint64(d.nl)>>3|uint64(d.nh)<<29)
return b, nil
}
func (h *sha256Hash) AppendBinary(b []byte) ([]byte, error) {
d := (*sha256Ctx)(unsafe.Pointer(&h.ctx))
b = append(b, magic256...)
- b = byteorder.BeAppendUint32(b, d.h[0])
- b = byteorder.BeAppendUint32(b, d.h[1])
- b = byteorder.BeAppendUint32(b, d.h[2])
- b = byteorder.BeAppendUint32(b, d.h[3])
- b = byteorder.BeAppendUint32(b, d.h[4])
- b = byteorder.BeAppendUint32(b, d.h[5])
- b = byteorder.BeAppendUint32(b, d.h[6])
- b = byteorder.BeAppendUint32(b, d.h[7])
+ b = byteorder.BEAppendUint32(b, d.h[0])
+ b = byteorder.BEAppendUint32(b, d.h[1])
+ b = byteorder.BEAppendUint32(b, d.h[2])
+ b = byteorder.BEAppendUint32(b, d.h[3])
+ b = byteorder.BEAppendUint32(b, d.h[4])
+ b = byteorder.BEAppendUint32(b, d.h[5])
+ b = byteorder.BEAppendUint32(b, d.h[6])
+ b = byteorder.BEAppendUint32(b, d.h[7])
b = append(b, d.x[:d.nx]...)
b = append(b, make([]byte, len(d.x)-int(d.nx))...)
- b = byteorder.BeAppendUint64(b, uint64(d.nl)>>3|uint64(d.nh)<<29)
+ b = byteorder.BEAppendUint64(b, uint64(d.nl)>>3|uint64(d.nh)<<29)
return b, nil
}
func (h *sha384Hash) AppendBinary(b []byte) ([]byte, error) {
d := (*sha512Ctx)(unsafe.Pointer(&h.ctx))
b = append(b, magic384...)
- b = byteorder.BeAppendUint64(b, d.h[0])
- b = byteorder.BeAppendUint64(b, d.h[1])
- b = byteorder.BeAppendUint64(b, d.h[2])
- b = byteorder.BeAppendUint64(b, d.h[3])
- b = byteorder.BeAppendUint64(b, d.h[4])
- b = byteorder.BeAppendUint64(b, d.h[5])
- b = byteorder.BeAppendUint64(b, d.h[6])
- b = byteorder.BeAppendUint64(b, d.h[7])
+ b = byteorder.BEAppendUint64(b, d.h[0])
+ b = byteorder.BEAppendUint64(b, d.h[1])
+ b = byteorder.BEAppendUint64(b, d.h[2])
+ b = byteorder.BEAppendUint64(b, d.h[3])
+ b = byteorder.BEAppendUint64(b, d.h[4])
+ b = byteorder.BEAppendUint64(b, d.h[5])
+ b = byteorder.BEAppendUint64(b, d.h[6])
+ b = byteorder.BEAppendUint64(b, d.h[7])
b = append(b, d.x[:d.nx]...)
b = append(b, make([]byte, len(d.x)-int(d.nx))...)
- b = byteorder.BeAppendUint64(b, d.nl>>3|d.nh<<61)
+ b = byteorder.BEAppendUint64(b, d.nl>>3|d.nh<<61)
return b, nil
}
func (h *sha512Hash) AppendBinary(b []byte) ([]byte, error) {
d := (*sha512Ctx)(unsafe.Pointer(&h.ctx))
b = append(b, magic512...)
- b = byteorder.BeAppendUint64(b, d.h[0])
- b = byteorder.BeAppendUint64(b, d.h[1])
- b = byteorder.BeAppendUint64(b, d.h[2])
- b = byteorder.BeAppendUint64(b, d.h[3])
- b = byteorder.BeAppendUint64(b, d.h[4])
- b = byteorder.BeAppendUint64(b, d.h[5])
- b = byteorder.BeAppendUint64(b, d.h[6])
- b = byteorder.BeAppendUint64(b, d.h[7])
+ b = byteorder.BEAppendUint64(b, d.h[0])
+ b = byteorder.BEAppendUint64(b, d.h[1])
+ b = byteorder.BEAppendUint64(b, d.h[2])
+ b = byteorder.BEAppendUint64(b, d.h[3])
+ b = byteorder.BEAppendUint64(b, d.h[4])
+ b = byteorder.BEAppendUint64(b, d.h[5])
+ b = byteorder.BEAppendUint64(b, d.h[6])
+ b = byteorder.BEAppendUint64(b, d.h[7])
b = append(b, d.x[:d.nx]...)
b = append(b, make([]byte, len(d.x)-int(d.nx))...)
- b = byteorder.BeAppendUint64(b, d.nl>>3|d.nh<<61)
+ b = byteorder.BEAppendUint64(b, d.nl>>3|d.nh<<61)
return b, nil
}
}
func consumeUint64(b []byte) ([]byte, uint64) {
- return b[8:], byteorder.BeUint64(b)
+ return b[8:], byteorder.BEUint64(b)
}
func consumeUint32(b []byte) ([]byte, uint32) {
- return b[4:], byteorder.BeUint32(b)
+ return b[4:], byteorder.BEUint32(b)
}
)
func LEUint16(b []byte) uint16 {
- return byteorder.LeUint16(b)
+ return byteorder.LEUint16(b)
}
func BEUint32(b []byte) uint32 {
- return byteorder.BeUint32(b)
+ return byteorder.BEUint32(b)
}
func BEUint64(b []byte) uint64 {
- return byteorder.BeUint64(b)
+ return byteorder.BEUint64(b)
}
func LEUint64(b []byte) uint64 {
- return byteorder.LeUint64(b)
+ return byteorder.LEUint64(b)
}
func BEPutUint16(b []byte, v uint16) {
- byteorder.BePutUint16(b, v)
+ byteorder.BEPutUint16(b, v)
}
func BEPutUint32(b []byte, v uint32) {
- byteorder.BePutUint32(b, v)
+ byteorder.BEPutUint32(b, v)
}
func BEPutUint64(b []byte, v uint64) {
- byteorder.BePutUint64(b, v)
+ byteorder.BEPutUint64(b, v)
}
func LEPutUint64(b []byte, v uint64) {
- byteorder.LePutUint64(b, v)
+ byteorder.LEPutUint64(b, v)
}
func BEAppendUint16(b []byte, v uint16) []byte {
- return byteorder.BeAppendUint16(b, v)
+ return byteorder.BEAppendUint16(b, v)
}
func BEAppendUint32(b []byte, v uint32) []byte {
- return byteorder.BeAppendUint32(b, v)
+ return byteorder.BEAppendUint32(b, v)
}
func BEAppendUint64(b []byte, v uint64) []byte {
- return byteorder.BeAppendUint64(b, v)
+ return byteorder.BEAppendUint64(b, v)
}
func (kdf *hkdfKDF) LabeledExpand(suiteID []byte, randomKey []byte, label string, info []byte, length uint16) []byte {
labeledInfo := make([]byte, 0, 2+7+len(suiteID)+len(label)+len(info))
- labeledInfo = byteorder.BeAppendUint16(labeledInfo, length)
+ labeledInfo = byteorder.BEAppendUint16(labeledInfo, length)
labeledInfo = append(labeledInfo, []byte("HPKE-v1")...)
labeledInfo = append(labeledInfo, suiteID...)
labeledInfo = append(labeledInfo, label...)
return &dhKEM{
dh: suite.curve,
kdf: hkdfKDF{suite.hash},
- suiteID: byteorder.BeAppendUint16([]byte("KEM"), kemID),
+ suiteID: byteorder.BEAppendUint16([]byte("KEM"), kemID),
nSecret: suite.nSecret,
}, nil
}
func suiteID(kemID, kdfID, aeadID uint16) []byte {
suiteID := make([]byte, 0, 4+2+2+2)
suiteID = append(suiteID, []byte("HPKE")...)
- suiteID = byteorder.BeAppendUint16(suiteID, kemID)
- suiteID = byteorder.BeAppendUint16(suiteID, kdfID)
- suiteID = byteorder.BeAppendUint16(suiteID, aeadID)
+ suiteID = byteorder.BEAppendUint16(suiteID, kemID)
+ suiteID = byteorder.BEAppendUint16(suiteID, kdfID)
+ suiteID = byteorder.BEAppendUint16(suiteID, aeadID)
return suiteID
}
func (u uint128) bytes() []byte {
b := make([]byte, 16)
- byteorder.BePutUint64(b[0:], u.hi)
- byteorder.BePutUint64(b[8:], u.lo)
+ byteorder.BEPutUint64(b[0:], u.hi)
+ byteorder.BEPutUint64(b[8:], u.lo)
return b
}
for len(b) >= 8 {
if x, ok := state.Next(); ok {
- byteorder.BePutUint64(b, x)
+ byteorder.BEPutUint64(b, x)
b = b[8:]
} else {
state.Refill()
for len(b) > 0 {
if x, ok := state.Next(); ok {
var buf [8]byte
- byteorder.BePutUint64(buf[:], x)
+ byteorder.BEPutUint64(buf[:], x)
n := copy(b, buf[:])
b = b[n:]
} else {
// load input block
{{range $i := seq 16 -}}
- {{printf "x%x := byteorder.LeUint32(q[4*%#x:])" $i $i}}
+ {{printf "x%x := byteorder.LEUint32(q[4*%#x:])" $i $i}}
{{end}}
// round 1
func (d *digest) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic...)
- b = byteorder.BeAppendUint32(b, d.s[0])
- b = byteorder.BeAppendUint32(b, d.s[1])
- b = byteorder.BeAppendUint32(b, d.s[2])
- b = byteorder.BeAppendUint32(b, d.s[3])
+ b = byteorder.BEAppendUint32(b, d.s[0])
+ b = byteorder.BEAppendUint32(b, d.s[1])
+ b = byteorder.BEAppendUint32(b, d.s[2])
+ b = byteorder.BEAppendUint32(b, d.s[3])
b = append(b, d.x[:d.nx]...)
b = append(b, make([]byte, len(d.x)-d.nx)...)
- b = byteorder.BeAppendUint64(b, d.len)
+ b = byteorder.BEAppendUint64(b, d.len)
return b, nil
}
}
func consumeUint64(b []byte) ([]byte, uint64) {
- return b[8:], byteorder.BeUint64(b[0:8])
+ return b[8:], byteorder.BEUint64(b[0:8])
}
func consumeUint32(b []byte) ([]byte, uint32) {
- return b[4:], byteorder.BeUint32(b[0:4])
+ return b[4:], byteorder.BEUint32(b[0:4])
}
// New returns a new [hash.Hash] computing the MD5 checksum. The Hash
// 1 byte end marker :: 0-63 padding bytes :: 8 byte length
tmp := [1 + 63 + 8]byte{0x80}
pad := (55 - d.len) % 64 // calculate number of padding bytes
- byteorder.LePutUint64(tmp[1+pad:], d.len<<3) // append length in bits
+ byteorder.LEPutUint64(tmp[1+pad:], d.len<<3) // append length in bits
d.Write(tmp[:1+pad+8])
// The previous write ensures that a whole number of
}
var digest [Size]byte
- byteorder.LePutUint32(digest[0:], d.s[0])
- byteorder.LePutUint32(digest[4:], d.s[1])
- byteorder.LePutUint32(digest[8:], d.s[2])
- byteorder.LePutUint32(digest[12:], d.s[3])
+ byteorder.LEPutUint32(digest[0:], d.s[0])
+ byteorder.LEPutUint32(digest[4:], d.s[1])
+ byteorder.LEPutUint32(digest[8:], d.s[2])
+ byteorder.LEPutUint32(digest[12:], d.s[3])
return digest
}
aa, bb, cc, dd := a, b, c, d
// load input block
- x0 := byteorder.LeUint32(q[4*0x0:])
- x1 := byteorder.LeUint32(q[4*0x1:])
- x2 := byteorder.LeUint32(q[4*0x2:])
- x3 := byteorder.LeUint32(q[4*0x3:])
- x4 := byteorder.LeUint32(q[4*0x4:])
- x5 := byteorder.LeUint32(q[4*0x5:])
- x6 := byteorder.LeUint32(q[4*0x6:])
- x7 := byteorder.LeUint32(q[4*0x7:])
- x8 := byteorder.LeUint32(q[4*0x8:])
- x9 := byteorder.LeUint32(q[4*0x9:])
- xa := byteorder.LeUint32(q[4*0xa:])
- xb := byteorder.LeUint32(q[4*0xb:])
- xc := byteorder.LeUint32(q[4*0xc:])
- xd := byteorder.LeUint32(q[4*0xd:])
- xe := byteorder.LeUint32(q[4*0xe:])
- xf := byteorder.LeUint32(q[4*0xf:])
+ x0 := byteorder.LEUint32(q[4*0x0:])
+ x1 := byteorder.LEUint32(q[4*0x1:])
+ x2 := byteorder.LEUint32(q[4*0x2:])
+ x3 := byteorder.LEUint32(q[4*0x3:])
+ x4 := byteorder.LEUint32(q[4*0x4:])
+ x5 := byteorder.LEUint32(q[4*0x5:])
+ x6 := byteorder.LEUint32(q[4*0x6:])
+ x7 := byteorder.LEUint32(q[4*0x7:])
+ x8 := byteorder.LEUint32(q[4*0x8:])
+ x9 := byteorder.LEUint32(q[4*0x9:])
+ xa := byteorder.LEUint32(q[4*0xa:])
+ xb := byteorder.LEUint32(q[4*0xb:])
+ xc := byteorder.LEUint32(q[4*0xc:])
+ xd := byteorder.LEUint32(q[4*0xd:])
+ xe := byteorder.LEUint32(q[4*0xe:])
+ xf := byteorder.LEUint32(q[4*0xf:])
// round 1
a = b + bits.RotateLeft32((((c^d)&b)^d)+a+x0+0xd76aa478, 7)
func (d *digest) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic...)
- b = byteorder.BeAppendUint32(b, d.h[0])
- b = byteorder.BeAppendUint32(b, d.h[1])
- b = byteorder.BeAppendUint32(b, d.h[2])
- b = byteorder.BeAppendUint32(b, d.h[3])
- b = byteorder.BeAppendUint32(b, d.h[4])
+ b = byteorder.BEAppendUint32(b, d.h[0])
+ b = byteorder.BEAppendUint32(b, d.h[1])
+ b = byteorder.BEAppendUint32(b, d.h[2])
+ b = byteorder.BEAppendUint32(b, d.h[3])
+ b = byteorder.BEAppendUint32(b, d.h[4])
b = append(b, d.x[:d.nx]...)
b = append(b, make([]byte, len(d.x)-d.nx)...)
- b = byteorder.BeAppendUint64(b, d.len)
+ b = byteorder.BEAppendUint64(b, d.len)
return b, nil
}
}
func consumeUint64(b []byte) ([]byte, uint64) {
- return b[8:], byteorder.BeUint64(b)
+ return b[8:], byteorder.BEUint64(b)
}
func consumeUint32(b []byte) ([]byte, uint32) {
- return b[4:], byteorder.BeUint32(b)
+ return b[4:], byteorder.BEUint32(b)
}
func (d *digest) Reset() {
// Length in bits.
len <<= 3
padlen := tmp[:t+8]
- byteorder.BePutUint64(padlen[t:], len)
+ byteorder.BEPutUint64(padlen[t:], len)
d.Write(padlen)
if d.nx != 0 {
var digest [Size]byte
- byteorder.BePutUint32(digest[0:], d.h[0])
- byteorder.BePutUint32(digest[4:], d.h[1])
- byteorder.BePutUint32(digest[8:], d.h[2])
- byteorder.BePutUint32(digest[12:], d.h[3])
- byteorder.BePutUint32(digest[16:], d.h[4])
+ byteorder.BEPutUint32(digest[0:], d.h[0])
+ byteorder.BEPutUint32(digest[4:], d.h[1])
+ byteorder.BEPutUint32(digest[8:], d.h[2])
+ byteorder.BEPutUint32(digest[12:], d.h[3])
+ byteorder.BEPutUint32(digest[16:], d.h[4])
return digest
}
// Write the shim ID we were passed as a little endian uint64
shimIDBytes := make([]byte, 8)
- byteorder.LePutUint64(shimIDBytes, *shimID)
+ byteorder.LEPutUint64(shimIDBytes, *shimID)
if _, err := conn.Write(shimIDBytes); err != nil {
log.Fatalf("failed to write shim id: %s", err)
}
return err
}
if len(skx.key) >= 3 && skx.key[0] == 3 /* named curve */ {
- c.curveID = CurveID(byteorder.BeUint16(skx.key[1:]))
+ c.curveID = CurveID(byteorder.BEUint16(skx.key[1:]))
}
msg, err = c.readHandshake(&hs.finishedHash)
var serverInfo bytes.Buffer
for _, ext := range test.extensions {
pem.Encode(&serverInfo, &pem.Block{
- Type: fmt.Sprintf("SERVERINFO FOR EXTENSION %d", byteorder.BeUint16(ext)),
+ Type: fmt.Sprintf("SERVERINFO FOR EXTENSION %d", byteorder.BEUint16(ext)),
Bytes: ext,
})
}
}
if skx != nil {
if len(skx.key) >= 3 && skx.key[0] == 3 /* named curve */ {
- c.curveID = CurveID(byteorder.BeUint16(skx.key[1:]))
+ c.curveID = CurveID(byteorder.BEUint16(skx.key[1:]))
}
if _, err := hs.c.writeHandshakeRecord(skx, &hs.finishedHash); err != nil {
return err
if _, err := c.config.rand().Read(ageAdd); err != nil {
return err
}
- m.ageAdd = byteorder.LeUint32(ageAdd)
+ m.ageAdd = byteorder.LEUint32(ageAdd)
if earlyData {
// RFC 9001, Section 4.6.1
func (d *digest) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic...)
- b = byteorder.BeAppendUint32(b, uint32(*d))
+ b = byteorder.BEAppendUint32(b, uint32(*d))
return b, nil
}
if len(b) != marshaledSize {
return errors.New("hash/adler32: invalid hash state size")
}
- *d = digest(byteorder.BeUint32(b[len(magic):]))
+ *d = digest(byteorder.BEUint32(b[len(magic):]))
return nil
}
func (d *digest) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic...)
- b = byteorder.BeAppendUint32(b, tableSum(d.tab))
- b = byteorder.BeAppendUint32(b, d.crc)
+ b = byteorder.BEAppendUint32(b, tableSum(d.tab))
+ b = byteorder.BEAppendUint32(b, d.crc)
return b, nil
}
if len(b) != marshaledSize {
return errors.New("hash/crc32: invalid hash state size")
}
- if tableSum(d.tab) != byteorder.BeUint32(b[4:]) {
+ if tableSum(d.tab) != byteorder.BEUint32(b[4:]) {
return errors.New("hash/crc32: tables do not match")
}
- d.crc = byteorder.BeUint32(b[8:])
+ d.crc = byteorder.BEUint32(b[8:])
return nil
}
b := a[:0]
if t != nil {
for _, x := range t {
- b = byteorder.BeAppendUint32(b, x)
+ b = byteorder.BEAppendUint32(b, x)
}
}
return ChecksumIEEE(b)
if len(p) >= slicing8Cutoff {
crc = ^crc
for len(p) > 8 {
- crc ^= byteorder.LeUint32(p)
+ crc ^= byteorder.LEUint32(p)
crc = tab[0][p[7]] ^ tab[1][p[6]] ^ tab[2][p[5]] ^ tab[3][p[4]] ^
tab[4][crc>>24] ^ tab[5][(crc>>16)&0xFF] ^
tab[6][(crc>>8)&0xFF] ^ tab[7][crc&0xFF]
func (d *digest) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic...)
- b = byteorder.BeAppendUint64(b, tableSum(d.tab))
- b = byteorder.BeAppendUint64(b, d.crc)
+ b = byteorder.BEAppendUint64(b, tableSum(d.tab))
+ b = byteorder.BEAppendUint64(b, d.crc)
return b, nil
}
if len(b) != marshaledSize {
return errors.New("hash/crc64: invalid hash state size")
}
- if tableSum(d.tab) != byteorder.BeUint64(b[4:]) {
+ if tableSum(d.tab) != byteorder.BEUint64(b[4:]) {
return errors.New("hash/crc64: tables do not match")
}
- d.crc = byteorder.BeUint64(b[12:])
+ d.crc = byteorder.BEUint64(b[12:])
return nil
}
}
// Update using slicing-by-8
for len(p) > 8 {
- crc ^= byteorder.LeUint64(p)
+ crc ^= byteorder.LEUint64(p)
crc = helperTable[7][crc&0xff] ^
helperTable[6][(crc>>8)&0xff] ^
helperTable[5][(crc>>16)&0xff] ^
b := a[:0]
if t != nil {
for _, x := range t {
- b = byteorder.BeAppendUint64(b, x)
+ b = byteorder.BEAppendUint64(b, x)
}
}
return Checksum(b, MakeTable(ISO))
func (s *sum32) Sum(in []byte) []byte {
v := uint32(*s)
- return byteorder.BeAppendUint32(in, v)
+ return byteorder.BEAppendUint32(in, v)
}
func (s *sum32a) Sum(in []byte) []byte {
v := uint32(*s)
- return byteorder.BeAppendUint32(in, v)
+ return byteorder.BEAppendUint32(in, v)
}
func (s *sum64) Sum(in []byte) []byte {
v := uint64(*s)
- return byteorder.BeAppendUint64(in, v)
+ return byteorder.BEAppendUint64(in, v)
}
func (s *sum64a) Sum(in []byte) []byte {
v := uint64(*s)
- return byteorder.BeAppendUint64(in, v)
+ return byteorder.BEAppendUint64(in, v)
}
func (s *sum128) Sum(in []byte) []byte {
- ret := byteorder.BeAppendUint64(in, s[0])
- return byteorder.BeAppendUint64(ret, s[1])
+ ret := byteorder.BEAppendUint64(in, s[0])
+ return byteorder.BEAppendUint64(ret, s[1])
}
func (s *sum128a) Sum(in []byte) []byte {
- ret := byteorder.BeAppendUint64(in, s[0])
- return byteorder.BeAppendUint64(ret, s[1])
+ ret := byteorder.BEAppendUint64(in, s[0])
+ return byteorder.BEAppendUint64(ret, s[1])
}
const (
func (s *sum32) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic32...)
- b = byteorder.BeAppendUint32(b, uint32(*s))
+ b = byteorder.BEAppendUint32(b, uint32(*s))
return b, nil
}
func (s *sum32a) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic32a...)
- b = byteorder.BeAppendUint32(b, uint32(*s))
+ b = byteorder.BEAppendUint32(b, uint32(*s))
return b, nil
}
func (s *sum64) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic64...)
- b = byteorder.BeAppendUint64(b, uint64(*s))
+ b = byteorder.BEAppendUint64(b, uint64(*s))
return b, nil
}
func (s *sum64a) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic64a...)
- b = byteorder.BeAppendUint64(b, uint64(*s))
+ b = byteorder.BEAppendUint64(b, uint64(*s))
return b, nil
}
func (s *sum128) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic128...)
- b = byteorder.BeAppendUint64(b, s[0])
- b = byteorder.BeAppendUint64(b, s[1])
+ b = byteorder.BEAppendUint64(b, s[0])
+ b = byteorder.BEAppendUint64(b, s[1])
return b, nil
}
func (s *sum128a) AppendBinary(b []byte) ([]byte, error) {
b = append(b, magic128a...)
- b = byteorder.BeAppendUint64(b, s[0])
- b = byteorder.BeAppendUint64(b, s[1])
+ b = byteorder.BEAppendUint64(b, s[0])
+ b = byteorder.BEAppendUint64(b, s[1])
return b, nil
}
if len(b) != marshaledSize32 {
return errors.New("hash/fnv: invalid hash state size")
}
- *s = sum32(byteorder.BeUint32(b[4:]))
+ *s = sum32(byteorder.BEUint32(b[4:]))
return nil
}
if len(b) != marshaledSize32 {
return errors.New("hash/fnv: invalid hash state size")
}
- *s = sum32a(byteorder.BeUint32(b[4:]))
+ *s = sum32a(byteorder.BEUint32(b[4:]))
return nil
}
if len(b) != marshaledSize64 {
return errors.New("hash/fnv: invalid hash state size")
}
- *s = sum64(byteorder.BeUint64(b[4:]))
+ *s = sum64(byteorder.BEUint64(b[4:]))
return nil
}
if len(b) != marshaledSize64 {
return errors.New("hash/fnv: invalid hash state size")
}
- *s = sum64a(byteorder.BeUint64(b[4:]))
+ *s = sum64a(byteorder.BEUint64(b[4:]))
return nil
}
if len(b) != marshaledSize128 {
return errors.New("hash/fnv: invalid hash state size")
}
- s[0] = byteorder.BeUint64(b[4:])
- s[1] = byteorder.BeUint64(b[12:])
+ s[0] = byteorder.BEUint64(b[4:])
+ s[1] = byteorder.BEUint64(b[12:])
return nil
}
if len(b) != marshaledSize128 {
return errors.New("hash/fnv: invalid hash state size")
}
- s[0] = byteorder.BeUint64(b[4:])
- s[1] = byteorder.BeUint64(b[12:])
+ s[0] = byteorder.BEUint64(b[4:])
+ s[1] = byteorder.BEUint64(b[12:])
return nil
}
switch v.Kind() {
case reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64, reflect.Int:
var buf [8]byte
- byteorder.LePutUint64(buf[:], uint64(v.Int()))
+ byteorder.LEPutUint64(buf[:], uint64(v.Int()))
h.Write(buf[:])
return
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint, reflect.Uintptr:
var buf [8]byte
- byteorder.LePutUint64(buf[:], v.Uint())
+ byteorder.LEPutUint64(buf[:], v.Uint())
h.Write(buf[:])
return
case reflect.Array:
var buf [8]byte
for i := range uint64(v.Len()) {
- byteorder.LePutUint64(buf[:], i)
+ byteorder.LEPutUint64(buf[:], i)
// do not want to hash to the same value,
// [2]string{"foo", ""} and [2]string{"", "foo"}.
h.Write(buf[:])
var buf [8]byte
for i := range v.NumField() {
f := v.Field(i)
- byteorder.LePutUint64(buf[:], uint64(i))
+ byteorder.LEPutUint64(buf[:], uint64(i))
// do not want to hash to the same value,
// struct{a,b string}{"foo",""} and
// struct{a,b string}{"","foo"}.
// because pointing to the abi.Escape call in comparableReady,
// So this is ok to hash pointer,
// this way because we know their target won't be moved.
- byteorder.LePutUint64(buf[:], uint64(v.Pointer()))
+ byteorder.LEPutUint64(buf[:], uint64(v.Pointer()))
h.Write(buf[:])
return
case reflect.Interface:
}
var buf [8]byte
if f != f {
- byteorder.LePutUint64(buf[:], randUint64())
+ byteorder.LEPutUint64(buf[:], randUint64())
h.Write(buf[:])
return
}
- byteorder.LePutUint64(buf[:], math.Float64bits(f))
+ byteorder.LEPutUint64(buf[:], math.Float64bits(f))
h.Write(buf[:])
}
func randUint64() uint64 {
buf := make([]byte, 8)
_, _ = rand.Read(buf)
- return byteorder.LeUint64(buf)
+ return byteorder.LEUint64(buf)
}
// This is a port of wyhash implementation in runtime/hash64.go,
}
func r4(p []byte) uint64 {
- return uint64(byteorder.LeUint32(p))
+ return uint64(byteorder.LEUint32(p))
}
func r8(p []byte) uint64 {
- return byteorder.LeUint64(p)
+ return byteorder.LEUint64(p)
}
func mix(a, b uint64) uint64 {
}
// Logical screen width and height.
- byteorder.LePutUint16(e.buf[0:2], uint16(e.g.Config.Width))
- byteorder.LePutUint16(e.buf[2:4], uint16(e.g.Config.Height))
+ byteorder.LEPutUint16(e.buf[0:2], uint16(e.g.Config.Width))
+ byteorder.LEPutUint16(e.buf[2:4], uint16(e.g.Config.Height))
e.write(e.buf[:4])
if p, ok := e.g.Config.ColorModel.(color.Palette); ok && len(p) > 0 {
}
e.buf[0] = 0x03 // Block Size.
e.buf[1] = 0x01 // Sub-block Index.
- byteorder.LePutUint16(e.buf[2:4], uint16(e.g.LoopCount))
+ byteorder.LEPutUint16(e.buf[2:4], uint16(e.g.LoopCount))
e.buf[4] = 0x00 // Block Terminator.
e.write(e.buf[:5])
}
} else {
e.buf[3] = 0x00 | disposal<<2
}
- byteorder.LePutUint16(e.buf[4:6], uint16(delay)) // Delay Time (1/100ths of a second)
+ byteorder.LEPutUint16(e.buf[4:6], uint16(delay)) // Delay Time (1/100ths of a second)
// Transparent color index.
if transparentIndex != -1 {
e.write(e.buf[:8])
}
e.buf[0] = sImageDescriptor
- byteorder.LePutUint16(e.buf[1:3], uint16(b.Min.X))
- byteorder.LePutUint16(e.buf[3:5], uint16(b.Min.Y))
- byteorder.LePutUint16(e.buf[5:7], uint16(b.Dx()))
- byteorder.LePutUint16(e.buf[7:9], uint16(b.Dy()))
+ byteorder.LEPutUint16(e.buf[1:3], uint16(b.Min.X))
+ byteorder.LEPutUint16(e.buf[3:5], uint16(b.Min.Y))
+ byteorder.LEPutUint16(e.buf[5:7], uint16(b.Dx()))
+ byteorder.LEPutUint16(e.buf[7:9], uint16(b.Dy()))
e.write(e.buf[:9])
// To determine whether or not this frame's palette is the same as the
// little and big endian integer types from/to byte slices.
package byteorder
-func LeUint16(b []byte) uint16 {
+func LEUint16(b []byte) uint16 {
_ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
return uint16(b[0]) | uint16(b[1])<<8
}
-func LePutUint16(b []byte, v uint16) {
+func LEPutUint16(b []byte, v uint16) {
_ = b[1] // early bounds check to guarantee safety of writes below
b[0] = byte(v)
b[1] = byte(v >> 8)
}
-func LeAppendUint16(b []byte, v uint16) []byte {
+func LEAppendUint16(b []byte, v uint16) []byte {
return append(b,
byte(v),
byte(v>>8),
)
}
-func LeUint32(b []byte) uint32 {
+func LEUint32(b []byte) uint32 {
_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
return uint32(b[0]) | uint32(b[1])<<8 | uint32(b[2])<<16 | uint32(b[3])<<24
}
-func LePutUint32(b []byte, v uint32) {
+func LEPutUint32(b []byte, v uint32) {
_ = b[3] // early bounds check to guarantee safety of writes below
b[0] = byte(v)
b[1] = byte(v >> 8)
b[3] = byte(v >> 24)
}
-func LeAppendUint32(b []byte, v uint32) []byte {
+func LEAppendUint32(b []byte, v uint32) []byte {
return append(b,
byte(v),
byte(v>>8),
)
}
-func LeUint64(b []byte) uint64 {
+func LEUint64(b []byte) uint64 {
_ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
return uint64(b[0]) | uint64(b[1])<<8 | uint64(b[2])<<16 | uint64(b[3])<<24 |
uint64(b[4])<<32 | uint64(b[5])<<40 | uint64(b[6])<<48 | uint64(b[7])<<56
}
-func LePutUint64(b []byte, v uint64) {
+func LEPutUint64(b []byte, v uint64) {
_ = b[7] // early bounds check to guarantee safety of writes below
b[0] = byte(v)
b[1] = byte(v >> 8)
b[7] = byte(v >> 56)
}
-func LeAppendUint64(b []byte, v uint64) []byte {
+func LEAppendUint64(b []byte, v uint64) []byte {
return append(b,
byte(v),
byte(v>>8),
)
}
-func BeUint16(b []byte) uint16 {
+func BEUint16(b []byte) uint16 {
_ = b[1] // bounds check hint to compiler; see golang.org/issue/14808
return uint16(b[1]) | uint16(b[0])<<8
}
-func BePutUint16(b []byte, v uint16) {
+func BEPutUint16(b []byte, v uint16) {
_ = b[1] // early bounds check to guarantee safety of writes below
b[0] = byte(v >> 8)
b[1] = byte(v)
}
-func BeAppendUint16(b []byte, v uint16) []byte {
+func BEAppendUint16(b []byte, v uint16) []byte {
return append(b,
byte(v>>8),
byte(v),
)
}
-func BeUint32(b []byte) uint32 {
+func BEUint32(b []byte) uint32 {
_ = b[3] // bounds check hint to compiler; see golang.org/issue/14808
return uint32(b[3]) | uint32(b[2])<<8 | uint32(b[1])<<16 | uint32(b[0])<<24
}
-func BePutUint32(b []byte, v uint32) {
+func BEPutUint32(b []byte, v uint32) {
_ = b[3] // early bounds check to guarantee safety of writes below
b[0] = byte(v >> 24)
b[1] = byte(v >> 16)
b[3] = byte(v)
}
-func BeAppendUint32(b []byte, v uint32) []byte {
+func BEAppendUint32(b []byte, v uint32) []byte {
return append(b,
byte(v>>24),
byte(v>>16),
)
}
-func BeUint64(b []byte) uint64 {
+func BEUint64(b []byte) uint64 {
_ = b[7] // bounds check hint to compiler; see golang.org/issue/14808
return uint64(b[7]) | uint64(b[6])<<8 | uint64(b[5])<<16 | uint64(b[4])<<24 |
uint64(b[3])<<32 | uint64(b[2])<<40 | uint64(b[1])<<48 | uint64(b[0])<<56
}
-func BePutUint64(b []byte, v uint64) {
+func BEPutUint64(b []byte, v uint64) {
_ = b[7] // early bounds check to guarantee safety of writes below
b[0] = byte(v >> 56)
b[1] = byte(v >> 48)
b[7] = byte(v)
}
-func BeAppendUint64(b []byte, v uint64) []byte {
+func BEAppendUint64(b []byte, v uint64) []byte {
return append(b,
byte(v>>56),
byte(v>>48),
// Init seeds the State with the given seed value.
func (s *State) Init(seed [32]byte) {
s.Init64([4]uint64{
- byteorder.LeUint64(seed[0*8:]),
- byteorder.LeUint64(seed[1*8:]),
- byteorder.LeUint64(seed[2*8:]),
- byteorder.LeUint64(seed[3*8:]),
+ byteorder.LEUint64(seed[0*8:]),
+ byteorder.LEUint64(seed[1*8:]),
+ byteorder.LEUint64(seed[2*8:]),
+ byteorder.LEUint64(seed[3*8:]),
})
}
data := make([]byte, 6*8)
copy(data, "chacha8:")
used := (s.c/ctrInc)*chunk + s.i
- byteorder.BePutUint64(data[1*8:], uint64(used))
+ byteorder.BEPutUint64(data[1*8:], uint64(used))
for i, seed := range s.seed {
- byteorder.LePutUint64(data[(2+i)*8:], seed)
+ byteorder.LEPutUint64(data[(2+i)*8:], seed)
}
return data
}
if len(data) != 6*8 || string(data[:8]) != "chacha8:" {
return new(errUnmarshalChaCha8)
}
- used := byteorder.BeUint64(data[1*8:])
+ used := byteorder.BEUint64(data[1*8:])
if used > (ctrMax/ctrInc)*chunk-reseed {
return new(errUnmarshalChaCha8)
}
for i := range s.seed {
- s.seed[i] = byteorder.LeUint64(data[(2+i)*8:])
+ s.seed[i] = byteorder.LEUint64(data[(2+i)*8:])
}
s.c = ctrInc * (uint32(used) / chunk)
block(&s.seed, &s.buf, s.c)
case 1:
return uint64(b[0])
case 2:
- return uint64(byteorder.LeUint16(b))
+ return uint64(byteorder.LEUint16(b))
case 4:
- return uint64(byteorder.LeUint32(b))
+ return uint64(byteorder.LEUint32(b))
case 8:
- return uint64(byteorder.LeUint64(b))
+ return uint64(byteorder.LEUint64(b))
default:
panic("internal/poll: readInt with unsupported size")
}
b |= 1
}
buf[1] = b
- byteorder.BePutUint32(buf[2:], x.prec)
+ byteorder.BEPutUint32(buf[2:], x.prec)
if x.form == finite {
- byteorder.BePutUint32(buf[6:], uint32(x.exp))
+ byteorder.BEPutUint32(buf[6:], uint32(x.exp))
x.mant[len(x.mant)-n:].bytes(buf[10:]) // cut off unused trailing words
}
z.acc = Accuracy((b>>3)&3) - 1
z.form = form((b >> 1) & 3)
z.neg = b&1 != 0
- z.prec = byteorder.BeUint32(buf[2:])
+ z.prec = byteorder.BEUint32(buf[2:])
if z.form == finite {
if len(buf) < 10 {
return errors.New("Float.GobDecode: buffer too small for finite form float")
}
- z.exp = int32(byteorder.BeUint32(buf[6:]))
+ z.exp = int32(byteorder.BEUint32(buf[6:]))
z.mant = z.mant.setBytes(buf[10:])
}
// bigEndianWord returns the contents of buf interpreted as a big-endian encoded Word value.
func bigEndianWord(buf []byte) Word {
if _W == 64 {
- return Word(byteorder.BeUint64(buf))
+ return Word(byteorder.BEUint64(buf))
}
- return Word(byteorder.BeUint32(buf))
+ return Word(byteorder.BEUint32(buf))
}
// setBytes interprets buf as the bytes of a big-endian unsigned
// this should never happen
return nil, errors.New("Rat.GobEncode: numerator too large")
}
- byteorder.BePutUint32(buf[j-4:j], uint32(n))
+ byteorder.BEPutUint32(buf[j-4:j], uint32(n))
j -= 1 + 4
b := ratGobVersion << 1 // make space for sign bit
if x.a.neg {
return fmt.Errorf("Rat.GobDecode: encoding version %d not supported", b>>1)
}
const j = 1 + 4
- ln := byteorder.BeUint32(buf[j-4 : j])
+ ln := byteorder.BEUint32(buf[j-4 : j])
if uint64(ln) > math.MaxInt-j {
return errors.New("Rat.GobDecode: invalid length")
}
p = p[n:]
}
for len(p) >= 8 {
- byteorder.LePutUint64(p, c.Uint64())
+ byteorder.LEPutUint64(p, c.Uint64())
p = p[8:]
n += 8
}
if len(p) > 0 {
- byteorder.LePutUint64(c.readBuf[:], c.Uint64())
+ byteorder.LEPutUint64(c.readBuf[:], c.Uint64())
n += copy(p, c.readBuf[:])
c.readLen = 8 - len(p)
}
// AppendBinary implements the [encoding.BinaryAppender] interface.
func (p *PCG) AppendBinary(b []byte) ([]byte, error) {
b = append(b, "pcg:"...)
- b = byteorder.BeAppendUint64(b, p.hi)
- b = byteorder.BeAppendUint64(b, p.lo)
+ b = byteorder.BEAppendUint64(b, p.hi)
+ b = byteorder.BEAppendUint64(b, p.lo)
return b, nil
}
if len(data) != 20 || string(data[:4]) != "pcg:" {
return errUnmarshalPCG
}
- p.hi = byteorder.BeUint64(data[4:])
- p.lo = byteorder.BeUint64(data[4+8:])
+ p.hi = byteorder.BEUint64(data[4:])
+ p.lo = byteorder.BEUint64(data[4+8:])
return nil
}
func AddrFrom16(addr [16]byte) Addr {
return Addr{
addr: uint128{
- byteorder.BeUint64(addr[:8]),
- byteorder.BeUint64(addr[8:]),
+ byteorder.BEUint64(addr[:8]),
+ byteorder.BEUint64(addr[8:]),
},
z: z6noz,
}
// [Addr.Zone] method to get it).
// The ip zero value returns all zeroes.
func (ip Addr) As16() (a16 [16]byte) {
- byteorder.BePutUint64(a16[:8], ip.addr.hi)
- byteorder.BePutUint64(a16[8:], ip.addr.lo)
+ byteorder.BEPutUint64(a16[:8], ip.addr.hi)
+ byteorder.BEPutUint64(a16[8:], ip.addr.lo)
return a16
}
// Note that 0.0.0.0 is not the zero Addr.
func (ip Addr) As4() (a4 [4]byte) {
if ip.z == z4 || ip.Is4In6() {
- byteorder.BePutUint32(a4[:], uint32(ip.addr.lo))
+ byteorder.BEPutUint32(a4[:], uint32(ip.addr.lo))
return a4
}
if ip.z == z0 {
return nil
case z4:
var ret [4]byte
- byteorder.BePutUint32(ret[:], uint32(ip.addr.lo))
+ byteorder.BEPutUint32(ret[:], uint32(ip.addr.lo))
return ret[:]
default:
var ret [16]byte
- byteorder.BePutUint64(ret[:8], ip.addr.hi)
- byteorder.BePutUint64(ret[8:], ip.addr.lo)
+ byteorder.BEPutUint64(ret[:8], ip.addr.hi)
+ byteorder.BEPutUint64(ret[8:], ip.addr.lo)
return ret[:]
}
}
switch ip.z {
case z0:
case z4:
- b = byteorder.BeAppendUint32(b, uint32(ip.addr.lo))
+ b = byteorder.BEAppendUint32(b, uint32(ip.addr.lo))
default:
- b = byteorder.BeAppendUint64(b, ip.addr.hi)
- b = byteorder.BeAppendUint64(b, ip.addr.lo)
+ b = byteorder.BEAppendUint64(b, ip.addr.hi)
+ b = byteorder.BEAppendUint64(b, ip.addr.lo)
b = append(b, ip.Zone()...)
}
return b, nil
if err != nil {
return nil, err
}
- return byteorder.LeAppendUint16(b, p.Port()), nil
+ return byteorder.LEAppendUint16(b, p.Port()), nil
}
// MarshalBinary implements the [encoding.BinaryMarshaler] interface.
if err != nil {
return err
}
- *p = AddrPortFrom(addr, byteorder.LeUint16(b[len(b)-2:]))
+ *p = AddrPortFrom(addr, byteorder.LEUint16(b[len(b)-2:]))
return nil
}
case 1:
return uint64(b[0])
case 2:
- return uint64(byteorder.BeUint16(b))
+ return uint64(byteorder.BEUint16(b))
case 4:
- return uint64(byteorder.BeUint32(b))
+ return uint64(byteorder.BEUint32(b))
case 8:
- return uint64(byteorder.BeUint64(b))
+ return uint64(byteorder.BEUint64(b))
default:
panic("syscall: readInt with unsupported size")
}
case 1:
return uint64(b[0])
case 2:
- return uint64(byteorder.LeUint16(b))
+ return uint64(byteorder.LEUint16(b))
case 4:
- return uint64(byteorder.LeUint32(b))
+ return uint64(byteorder.LEUint32(b))
case 8:
- return uint64(byteorder.LeUint64(b))
+ return uint64(byteorder.LEUint64(b))
default:
panic("syscall: readInt with unsupported size")
}
buf := make([]byte, 8)
for {
if x, ok := globalRand.state.Next(); ok {
- byteorder.BePutUint64(buf, x)
+ byteorder.BEPutUint64(buf, x)
break
}
globalRand.state.Refill()
// pbit16 copies the 16-bit number v to b in little-endian order and returns the remaining slice of b.
func pbit16(b []byte, v uint16) []byte {
- byteorder.LePutUint16(b, v)
+ byteorder.LEPutUint16(b, v)
return b[2:]
}
// pbit32 copies the 32-bit number v to b in little-endian order and returns the remaining slice of b.
func pbit32(b []byte, v uint32) []byte {
- byteorder.LePutUint32(b, v)
+ byteorder.LEPutUint32(b, v)
return b[4:]
}
// pbit64 copies the 64-bit number v to b in little-endian order and returns the remaining slice of b.
func pbit64(b []byte, v uint64) []byte {
- byteorder.LePutUint64(b, v)
+ byteorder.LEPutUint64(b, v)
return b[8:]
}
//
//go:nosplit
func gbit16(b []byte) (uint16, []byte) {
- return byteorder.LeUint16(b), b[2:]
+ return byteorder.LEUint16(b), b[2:]
}
// gbit32 reads a 32-bit number in little-endian order from b and returns it with the remaining slice of b.
func gbit32(b []byte) (uint32, []byte) {
- return byteorder.LeUint32(b), b[4:]
+ return byteorder.LEUint32(b), b[4:]
}
// gbit64 reads a 64-bit number in little-endian order from b and returns it with the remaining slice of b.
func gbit64(b []byte) (uint64, []byte) {
- return byteorder.LeUint64(b), b[8:]
+ return byteorder.LEUint64(b), b[8:]
}
// gstring reads a string from b, prefixed with a 16-bit length in little-endian order.
case 1:
return uint64(b[0])
case 2:
- return uint64(byteorder.BeUint16(b))
+ return uint64(byteorder.BEUint16(b))
case 4:
- return uint64(byteorder.BeUint32(b))
+ return uint64(byteorder.BEUint32(b))
case 8:
- return uint64(byteorder.BeUint64(b))
+ return uint64(byteorder.BEUint64(b))
default:
panic("syscall: readInt with unsupported size")
}
case 1:
return uint64(b[0])
case 2:
- return uint64(byteorder.LeUint16(b))
+ return uint64(byteorder.LEUint16(b))
case 4:
- return uint64(byteorder.LeUint32(b))
+ return uint64(byteorder.LEUint32(b))
case 8:
- return uint64(byteorder.LeUint64(b))
+ return uint64(byteorder.LEUint64(b))
default:
panic("syscall: readInt with unsupported size")
}