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)
| 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. |
| 362 | func (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. |
nothing calls this directly
no test coverage detected