uint
uint copied to clipboard
Rust Uint crate using const-generics
*On 2022-05-28 @recmo wrote in [`1ec2e50`](https://github.com/recmo/uint/commit/1ec2e50003548890260e8c06886f44fd826bc07b) “Recognize new tags”:* Special functions Factorial Extended GCD and LCM https://en.wikipedia.org/wiki/Euler%27s_totient_function https://en.wikipedia.org/wiki/Carmichael_function https://en.wikipedia.org/wiki/Jordan%27s_totient_function Feature parity with GMP: https://gmplib.org/manual/Integer-Functions.html#Integer-Functions ```rust use crate::Uint; // FEATURE: Special...
*On 2022-05-28 @recmo wrote in [`1ec2e50`](https://github.com/recmo/uint/commit/1ec2e50003548890260e8c06886f44fd826bc07b) “Recognize new tags”:* Support proper unicode. Ignore zero-width spaces, joiners, etc. Recognize digits from other alphabets. ```rust /// # Errors /// /// * [`ParseError::InvalidDigit`]...
*On 2022-05-28 @recmo wrote in [`1ec2e50`](https://github.com/recmo/uint/commit/1ec2e50003548890260e8c06886f44fd826bc07b) “Recognize new tags”:* Respect width parameter in formatters. ```rust Binary, Debug, Display, Formatter, LowerHex, Octal, Result as FmtResult, UpperHex, }; use std::str::FromStr; use thiserror::Error;...
*On 2022-05-28 @recmo wrote in [`d2363fc`](https://github.com/recmo/uint/commit/d2363fc59b20c9ad1c827634b3003825dd02e2c6) “blocked”:* _to_smallvec to avoid allocation. ```rust ptr::{addr_of, addr_of_mut}, slice, }; use std::borrow::Cow; // OPT: *_to_smallvec to avoid allocation. impl Uint { /// The size...
*On 2022-05-28 @recmo wrote in [`d2363fc`](https://github.com/recmo/uint/commit/d2363fc59b20c9ad1c827634b3003825dd02e2c6) “blocked”:* todo!() ```rust /// This function will panic if `rhs` is 0 or the operation results in /// overflow. #[must_use] pub fn next_multiple_of(self, rhs:...
*On 2022-05-28 @recmo wrote in [`d2363fc`](https://github.com/recmo/uint/commit/d2363fc59b20c9ad1c827634b3003825dd02e2c6) “blocked”:* todo!() ```rust /// This function will panic if `rhs` is 0 or the operation results in /// overflow. #[must_use] pub fn next_multiple_of(self, rhs:...
*On 2022-05-28 @recmo wrote in [`b0b5d54`](https://github.com/recmo/uint/commit/b0b5d5401643d19747653934e838604cd59bcd81) “Mod names”:* keep track of non-zero limbs and mul the minimum. ```rust for digit in digits { if digit >= base { return Err(BaseConvertError::InvalidDigit(digit,...
*On 2022-05-28 @recmo wrote in [`b0b5d54`](https://github.com/recmo/uint/commit/b0b5d5401643d19747653934e838604cd59bcd81) “Mod names”:* If we keep track of leading zero limbs we can half iterations. ```rust #[allow(clippy::cast_possible_truncation)] // Doesn't truncate fn next(&mut self) -> Option...
*On 2022-05-28 @recmo wrote in [`b0b5d54`](https://github.com/recmo/uint/commit/b0b5d5401643d19747653934e838604cd59bcd81) “Mod names”:* Same trick as with `to_base_le`, find the largest power of base that fits `u64` and accumulate there first. ```rust base: u64, digits:...