MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / bigEndianByteAt

Function bigEndianByteAt

utils/big.go:150–162  ·  view source on GitHub ↗

bigEndianByteAt returns the byte at position n, in Big-Endian encoding So n==0 returns the least significant byte.

(bigint *big.Int, n int)

Source from the content-addressed store, hash-verified

148// in Big-Endian encoding
149// So n==0 returns the least significant byte.
150func 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.

Callers 4

ByteFunction · 0.85
BenchmarkByteAtBrandNewFunction · 0.85
BenchmarkByteAtFunction · 0.85
TestBigEndianByteAtFunction · 0.85

Calls

no outgoing calls

Tested by 3

BenchmarkByteAtBrandNewFunction · 0.68
BenchmarkByteAtFunction · 0.68
TestBigEndianByteAtFunction · 0.68