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

Function ReadBits

utils/big.go:177–186  ·  view source on GitHub ↗

ReadBits encodes the absolute value of bigint as big-endian bytes. Callers must ensure that buf has enough space. If buf is too short the result will be incomplete.

(bigint *big.Int, buf []byte)

Source from the content-addressed store, hash-verified

175// ReadBits encodes the absolute value of bigint as big-endian bytes. Callers must ensure
176// that buf has enough space. If buf is too short the result will be incomplete.
177func ReadBits(bigint *big.Int, buf []byte) {
178 i := len(buf)
179 for _, d := range bigint.Bits() {
180 for j := 0; j < wordBytes && i > 0; j++ {
181 i--
182 buf[i] = byte(d)
183 d >>= 8
184 }
185 }
186}
187
188// U256 encodes as a 256 bit two's complement number. This operation is destructive.
189func U256(x *big.Int) *big.Int {

Callers 2

PaddedBigBytesFunction · 0.85
TestReadBitsFunction · 0.85

Calls

no outgoing calls

Tested by 1

TestReadBitsFunction · 0.68