mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #5890 from kralo/fix-5884
factor: remove clippy exceptions by reformatting "unreadable literals"
This commit is contained in:
commit
6e09cbaefd
4 changed files with 9 additions and 12 deletions
|
@ -3,7 +3,7 @@
|
||||||
// For the full copyright and license information, please view the LICENSE
|
// For the full copyright and license information, please view the LICENSE
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
|
|
||||||
//! Generate a table of the multiplicative inverses of p_i mod 2^64
|
//! Generate a table of the multiplicative inverses of `p_i` mod 2^64
|
||||||
//! for the first 1027 odd primes (all 13 bit and smaller primes).
|
//! for the first 1027 odd primes (all 13 bit and smaller primes).
|
||||||
//! You can supply a command line argument to override the default
|
//! You can supply a command line argument to override the default
|
||||||
//! value of 1027 for the number of entries in the table.
|
//! value of 1027 for the number of entries in the table.
|
||||||
|
@ -87,7 +87,7 @@ fn test_generator_10001() {
|
||||||
}
|
}
|
||||||
|
|
||||||
const MAX_WIDTH: usize = 102;
|
const MAX_WIDTH: usize = 102;
|
||||||
const PREAMBLE: &str = r##"/*
|
const PREAMBLE: &str = r"/*
|
||||||
* This file is part of the uutils coreutils package.
|
* This file is part of the uutils coreutils package.
|
||||||
*
|
*
|
||||||
* For the full copyright and license information, please view the LICENSE file
|
* For the full copyright and license information, please view the LICENSE file
|
||||||
|
@ -100,4 +100,4 @@ const PREAMBLE: &str = r##"/*
|
||||||
|
|
||||||
#[allow(clippy::unreadable_literal)]
|
#[allow(clippy::unreadable_literal)]
|
||||||
pub const PRIME_INVERSIONS_U64: &[(u64, u64, u64)] = &[
|
pub const PRIME_INVERSIONS_U64: &[(u64, u64, u64)] = &[
|
||||||
"##;
|
";
|
||||||
|
|
|
@ -217,7 +217,7 @@ mod tests {
|
||||||
// This is a strong pseudoprime (wrt. miller_rabin::BASIS)
|
// This is a strong pseudoprime (wrt. miller_rabin::BASIS)
|
||||||
// and triggered a bug in rho::factor's code path handling
|
// and triggered a bug in rho::factor's code path handling
|
||||||
// miller_rabbin::Result::Composite
|
// miller_rabbin::Result::Composite
|
||||||
let pseudoprime = 17179869183;
|
let pseudoprime = 17_179_869_183;
|
||||||
for _ in 0..20 {
|
for _ in 0..20 {
|
||||||
// Repeat the test 20 times, as it only fails some fraction
|
// Repeat the test 20 times, as it only fails some fraction
|
||||||
// of the time.
|
// of the time.
|
||||||
|
|
|
@ -14,19 +14,17 @@ pub(crate) trait Basis {
|
||||||
impl Basis for Montgomery<u64> {
|
impl Basis for Montgomery<u64> {
|
||||||
// Small set of bases for the Miller-Rabin prime test, valid for all 64b integers;
|
// Small set of bases for the Miller-Rabin prime test, valid for all 64b integers;
|
||||||
// discovered by Jim Sinclair on 2011-04-20, see miller-rabin.appspot.com
|
// discovered by Jim Sinclair on 2011-04-20, see miller-rabin.appspot.com
|
||||||
#[allow(clippy::unreadable_literal)]
|
const BASIS: &'static [u64] = &[2, 325, 9375, 28178, 450_775, 9_780_504, 1_795_265_022];
|
||||||
const BASIS: &'static [u64] = &[2, 325, 9375, 28178, 450775, 9780504, 1795265022];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Basis for Montgomery<u32> {
|
impl Basis for Montgomery<u32> {
|
||||||
// spell-checker:ignore (names) Steve Worley
|
// spell-checker:ignore (names) Steve Worley
|
||||||
// Small set of bases for the Miller-Rabin prime test, valid for all 32b integers;
|
// Small set of bases for the Miller-Rabin prime test, valid for all 32b integers;
|
||||||
// discovered by Steve Worley on 2013-05-27, see miller-rabin.appspot.com
|
// discovered by Steve Worley on 2013-05-27, see miller-rabin.appspot.com
|
||||||
#[allow(clippy::unreadable_literal)]
|
|
||||||
const BASIS: &'static [u64] = &[
|
const BASIS: &'static [u64] = &[
|
||||||
4230279247111683200,
|
4_230_279_247_111_683_200,
|
||||||
14694767155120705706,
|
14_694_767_155_120_705_706,
|
||||||
16641139526367750375,
|
16_641_139_526_367_750_375,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +110,7 @@ mod tests {
|
||||||
use crate::numeric::{traits::DoubleInt, Arithmetic, Montgomery};
|
use crate::numeric::{traits::DoubleInt, Arithmetic, Montgomery};
|
||||||
use quickcheck::quickcheck;
|
use quickcheck::quickcheck;
|
||||||
use std::iter;
|
use std::iter;
|
||||||
const LARGEST_U64_PRIME: u64 = 0xFFFFFFFFFFFFFFC5;
|
const LARGEST_U64_PRIME: u64 = 0xFFFF_FFFF_FFFF_FFC5;
|
||||||
|
|
||||||
fn primes() -> impl Iterator<Item = u64> {
|
fn primes() -> impl Iterator<Item = u64> {
|
||||||
iter::once(2).chain(odd_primes())
|
iter::once(2).chain(odd_primes())
|
||||||
|
|
|
@ -2,7 +2,6 @@
|
||||||
//
|
//
|
||||||
// For the full copyright and license information, please view the LICENSE
|
// For the full copyright and license information, please view the LICENSE
|
||||||
// file that was distributed with this source code.
|
// file that was distributed with this source code.
|
||||||
#![allow(clippy::unreadable_literal)]
|
|
||||||
|
|
||||||
// spell-checker:ignore (methods) hexdigest
|
// spell-checker:ignore (methods) hexdigest
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue