copyWords was adapted from math/big/nat.go. It writes the value of nat into buf using big-endian encoding. len(buf) must be >= len(nat)*bigWordSize.
(buf []byte, nat []big.Word)
| 743 | // copyWords was adapted from math/big/nat.go. It writes the value of |
| 744 | // nat into buf using big-endian encoding. len(buf) must be >= len(nat)*bigWordSize. |
| 745 | func copyWords(buf []byte, nat []big.Word) []byte { |
| 746 | // Omit leading zeros from the resulting byte slice, which is both |
| 747 | // safe and exactly what big.Int.Bytes() does. See big.nat.setBytes() |
| 748 | // and big.nat.norm() for how this is normalized on decoding. |
| 749 | leading := true |
| 750 | for w := len(nat) - 1; w >= 0; w-- { |
| 751 | d := nat[w] |
| 752 | for j := bigWordSize - 1; j >= 0; j-- { |
| 753 | by := byte(d >> (8 * big.Word(j))) |
| 754 | if by == 0 && leading { |
| 755 | continue |
| 756 | } |
| 757 | leading = false |
| 758 | buf = append(buf, by) |
| 759 | } |
| 760 | } |
| 761 | return buf |
| 762 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…