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)
| 198 | // S256(2**255) = -2**255 |
| 199 | // S256(2**256-1) = -1. |
| 200 | func 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 |