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

Function S256

utils/big.go:200–205  ·  view source on GitHub ↗

S256 interprets x as a two's complement number. x must not exceed 256 bits (the result is undefined if it does) and is not modified. S256(0) = 0 S256(1) = 1 S256(2**255) = -2**255 S256(2**256-1) = -1.

(x *big.Int)

Source from the content-addressed store, hash-verified

198// S256(2**255) = -2**255
199// S256(2**256-1) = -1.
200func S256(x *big.Int) *big.Int {
201 if x.Cmp(tt255) < 0 {
202 return x
203 }
204 return new(big.Int).Sub(x, tt256)
205}
206
207// Exp implements exponentiation by squaring.
208// Exp returns a newly-allocated big integer and does not change

Callers 1

TestS256Function · 0.70

Calls

no outgoing calls

Tested by 1

TestS256Function · 0.56