bigEndianByteAt returns the byte at position n, in Big-Endian encoding So n==0 returns the least significant byte.
(bigint *big.Int, n int)
| 148 | // in Big-Endian encoding |
| 149 | // So n==0 returns the least significant byte. |
| 150 | func bigEndianByteAt(bigint *big.Int, n int) byte { |
| 151 | words := bigint.Bits() |
| 152 | // Check word-bucket the byte will reside in |
| 153 | i := n / wordBytes |
| 154 | if i >= len(words) { |
| 155 | return byte(0) |
| 156 | } |
| 157 | word := words[i] |
| 158 | // Offset of the byte |
| 159 | shift := 8 * uint(n%wordBytes) |
| 160 | |
| 161 | return byte(word >> shift) |
| 162 | } |
| 163 | |
| 164 | // Byte returns the byte at position n, |
| 165 | // with the supplied padlength in Little-Endian encoding. |
no outgoing calls