Commit Graph

13 Commits

Author SHA1 Message Date
Josh Stone d2bf4e04e4 Run cargo fmt 2018-07-12 17:09:22 -07:00
Josh Stone 51f6c57c4b Automatically detect support for i128/u128 2018-05-11 15:50:48 -07:00
Josh Stone fe53805550 impl 128-bit CheckedRem and CheckedNeg 2018-05-07 12:28:15 -07:00
Josh Stone 261efafe0b Merge branch 'master' into regexident-i128 2018-05-04 12:28:48 -07:00
Josh Stone 4fb749a401 typo: taht -> that 2018-04-13 14:29:00 -07:00
Josh Stone b1c4074cc4 Document CheckedRem and CheckedNeg 2018-04-13 14:14:22 -07:00
Josh Stone 5fb3724b69 rename checked_impl_one_param to checked_impl_unary 2018-04-13 14:13:42 -07:00
LEXUGE f74de249c8
remove formats 2018-04-13 16:04:56 +08:00
Vincent Esche b44666183d Added impls of `Checked…` for `i128` and `u128` 2018-04-09 11:10:51 +02:00
Vinzent Steinberg a843027b56 Re-introduce the std feature
This is a port of @vks's rust-num/num#296, but without the feature-
toggled changes to `Float`.
2018-01-31 15:42:55 -08:00
Fabian Schuiki 809ccff63f Fix checked shift RHS to u32, drop from PrimInt
Make the checked left and right shifts take a `u32` as right-hand side,
which is more consistent with the other checked operations. Also drop
`CheckedShl` and `CheckedShr` from the `PrimInt` trait, to not break
existing code. Add doctests for the two traits.
2018-01-13 15:02:38 +01:00
Fabian Schuiki 21dfae004c Add checked shifts
Add traits `CheckedShl` and `CheckedShr` that correspond to the standard
library's `checked_shl` and `checked_shr` functions. Implement the trait
on all primitive integer types by default, akin to what the standard
library does.

The stdlib is somewhat inconsistent when it comes to the type of the
shift amount. The `checked_*` functions have a `u32` shift amount, but
the `std::ops::{Shl,Shr}` traits are generic over the shift amount. Also
the stdlib implements these traits for all primitive integer types as
right-hand sides. Our implementation mimics this behaviour.
2018-01-03 16:25:13 +01:00
Josh Stone 42a610d323 Move num-traits to its own repo
All the prior `num` history is kept, so old `num-traits` tags are still
valid, but future development here will be just for `num-traits`.
2017-12-18 17:35:41 -08:00