# std: Add/Fix/Change parts of big.int · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/a31b70c4b8d0bed67463b2f54e74198baa93329f)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: a31b70c4b8d0bed67463b2f54e74198baa93329f

Requested commit: a31b70c4b8d0bed67463b2f54e74198baa93329f

Commit: a31b70c4b8d0bed67463b2f54e74198baa93329f

Tree: 7be5aefedf537b92c8860b924617e55855e9daab

Author: LemonBoy

Committer: Andrew Kelley

## Message

```
std: Add/Fix/Change parts of big.int

* Add an optimized squaring routine under the `sqr` name.
  Algorithms for squaring bigger numbers efficiently will come in a
  PR later.
* Fix a bug where a multiplication was done twice if the threshold for
  the use of Karatsuba algorithm was crossed. Add a test to make sure
  this won't happen again.
* Streamline `pow` method, take a `Const` parameter.
* Minor tweaks to `pow`, avoid bit-reversing the exponent.

```

## Parents

- [fbc6a00b0a939f8752bbd571284c46ab58a8fcc4](https://git.cafe/gitcafe/zig/commit/fbc6a00b0a939f8752bbd571284c46ab58a8fcc4?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/a31b70c4b8d0bed67463b2f54e74198baa93329f?format=markdown)
