MCPcopy Create free account
hub / github.com/DOSNetwork/core / BigEndian

Method BigEndian

group/mod/int.go:362–374  ·  view source on GitHub ↗

BigEndian encodes the value of this Int into a big-endian byte-slice at least min bytes but no more than max bytes long. Panics if max != 0 and the Int cannot be represented in max bytes.

(min, max int)

Source from the content-addressed store, hash-verified

360// at least min bytes but no more than max bytes long.
361// Panics if max != 0 and the Int cannot be represented in max bytes.
362func (i *Int) BigEndian(min, max int) []byte {
363 act := i.MarshalSize()
364 pad, ofs := act, 0
365 if pad < min {
366 pad, ofs = min, min-act
367 }
368 if max != 0 && pad > max {
369 panic("Int not representable in max bytes")
370 }
371 buf := make([]byte, pad)
372 copy(buf[ofs:], i.V.Bytes())
373 return buf
374}
375
376// SetBytes set the value value to a number represented
377// by a byte string.

Callers

nothing calls this directly

Calls 1

MarshalSizeMethod · 0.95

Tested by

no test coverage detected