Commit Graph

6 Commits

Author SHA1 Message Date
Joe Richey 0445b3e5c1
Use improved algorithm that only uses shifts
This new algorithm (taken from Wikipedia) only uses shifts, addditions,
and subtrations. On my x86_64 machine, the benchmarks are over twice as
fast.

This also takes num-traits as a dependancy, so that the implementation
can be a normal generic function, instread of a macro.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 04:50:50 -07:00
Joe Richey 260148e029
Simplify impl_isqrt macro
We don't need multiple cases in the macro_rules!

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-07 20:19:44 -07:00
Richard Dodd 9e6ffa6f81 Fix overflow in some edge cases. 2020-01-24 12:25:14 +00:00
Sergey Pepyakin 01bb91452f Add u128 and i128. 2018-10-30 12:22:24 +01:00
Richard Dodd 5bbfb9187d Add no_std and fix tests 2018-03-02 21:37:51 +00:00
Richard Dodd 00aabcfe32 First commit 2017-10-23 13:29:42 +01:00