Commit Graph

21 Commits

Author SHA1 Message Date
Michael Pfaff 83649f11fa
Make const 2022-03-01 18:30:30 -05:00
Richard Dodd 2df2b3c365 Add CI badge 2020-09-09 11:04:37 +01:00
Richard Dodd (dodj) d3fc26c795
Create main.yml 2020-09-09 10:51:48 +01:00
Richard Dodd (dodj) 282d0d4e26
Merge pull request #13 from xlc/patch-1
Allow to disable std feature
2020-09-09 10:43:19 +01:00
Xiliang Chen e6f8f33c73
Update Cargo.toml 2020-09-09 20:42:00 +12:00
Xiliang Chen 8cd1b01cb5
Update Cargo.toml
Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
2020-09-09 20:41:38 +12:00
Xiliang Chen baded5a6f2
Allow to disable std feature 2020-09-09 17:32:38 +12:00
Richard Dodd 8bfb983bac Update version, authors. 2020-09-08 14:01:26 +01:00
Richard Dodd 04f704a0f8 Update for 2018 rust 2020-09-08 13:59:37 +01:00
Joe Richey e620eeed5e Remove impl_isqrt macro
The implementation can now just use a normal generic impl. Note that
this is tecnically a minor breaking change, as if a user has both:
  - A custom num_traits::PrimInt impl
  - A custom IntegerSquareRoot impl

Their code will no longer compile

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 13:56:05 +01:00
Richard Dodd (dodj) e0a70c1472
Merge pull request #10 from josephlr/master
Improve algorithm and add benchmarks
2020-09-08 13:54:12 +01:00
Joe Richey 1e02bdb415 Use leading_zeros to compute initial bit
This increases performance on processors with lzcnt instructions.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-08 04:51:18 -07:00
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
Joe Richey f96b2b2113
benches: Add benchmarks
This allows comparison of alternative implementaitons, and to the
f64::sqrt() implementation.

Signed-off-by: Joe Richey <joerichey@google.com>
2020-09-07 20:16:28 -07:00
Richard Dodd 9e6ffa6f81 Fix overflow in some edge cases. 2020-01-24 12:25:14 +00:00
Richard Dodd fab12a7a66 Bump version for release 2018-10-30 11:50:20 +00:00
Richard Dodd (dodj) c86936f7d5
Merge pull request #7 from paritytech/ser-128
Add u128 and i128.
2018-10-30 11:47:43 +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