Skip to content

apply nightly clippy fixes: const div_ceil (2025-05-12) #968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions slh-dsa/src/hashes/sha2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ impl HypertreeParams for Sha2_128s {
impl ForsParams for Sha2_128s {
type K = U<14>;
type A = U<12>;
type MD = U<{ (12 * 14 + 7) / 8 }>;
type MD = U<{ (12 * 14usize).div_ceil(8) }>;
}
impl ParameterSet for Sha2_128s {
const NAME: &'static str = "SLH-DSA-SHA2-128s";
Expand Down Expand Up @@ -329,7 +329,7 @@ impl HypertreeParams for Sha2_192s {
impl ForsParams for Sha2_192s {
type K = U<17>;
type A = U<14>;
type MD = U<{ (14 * 17 + 7) / 8 }>;
type MD = U<{ (14 * 17usize).div_ceil(8) }>;
}
impl ParameterSet for Sha2_192s {
const NAME: &'static str = "SLH-DSA-SHA2-192s";
Expand All @@ -352,7 +352,7 @@ impl HypertreeParams for Sha2_192f {
impl ForsParams for Sha2_192f {
type K = U<33>;
type A = U<8>;
type MD = U<{ (33 * 8 + 7) / 8 }>;
type MD = U<{ (33 * 8usize).div_ceil(8) }>;
}
impl ParameterSet for Sha2_192f {
const NAME: &'static str = "SLH-DSA-SHA2-192f";
Expand All @@ -375,7 +375,7 @@ impl HypertreeParams for Sha2_256s {
impl ForsParams for Sha2_256s {
type K = U<22>;
type A = U<14>;
type MD = U<{ (14 * 22 + 7) / 8 }>;
type MD = U<{ (14 * 22usize).div_ceil(8) }>;
}
impl ParameterSet for Sha2_256s {
const NAME: &'static str = "SLH-DSA-SHA2-256s";
Expand All @@ -398,7 +398,7 @@ impl HypertreeParams for Sha2_256f {
impl ForsParams for Sha2_256f {
type K = U<35>;
type A = U<9>;
type MD = U<{ (35 * 9 + 7) / 8 }>;
type MD = U<{ (35 * 9usize).div_ceil(8) }>;
}
impl ParameterSet for Sha2_256f {
const NAME: &'static str = "SLH-DSA-SHA2-256f";
Expand Down
10 changes: 5 additions & 5 deletions slh-dsa/src/hashes/shake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl HypertreeParams for Shake128s {
impl ForsParams for Shake128s {
type K = U<14>;
type A = U<12>;
type MD = U<{ (12 * 14 + 7) / 8 }>;
type MD = U<{ (12 * 14usize).div_ceil(8) }>;
}
impl ParameterSet for Shake128s {
const NAME: &'static str = "SLH-DSA-SHAKE-128s";
Expand Down Expand Up @@ -189,7 +189,7 @@ impl HypertreeParams for Shake192s {
impl ForsParams for Shake192s {
type K = U<17>;
type A = U<14>;
type MD = U<{ (14 * 17 + 7) / 8 }>;
type MD = U<{ (14 * 17usize).div_ceil(8) }>;
}
impl ParameterSet for Shake192s {
const NAME: &'static str = "SLH-DSA-SHAKE-192s";
Expand All @@ -212,7 +212,7 @@ impl HypertreeParams for Shake192f {
impl ForsParams for Shake192f {
type K = U<33>;
type A = U<8>;
type MD = U<{ (33 * 8 + 7) / 8 }>;
type MD = U<{ (33 * 8usize).div_ceil(8) }>;
}
impl ParameterSet for Shake192f {
const NAME: &'static str = "SLH-DSA-SHAKE-192f";
Expand All @@ -235,7 +235,7 @@ impl HypertreeParams for Shake256s {
impl ForsParams for Shake256s {
type K = U<22>;
type A = U<14>;
type MD = U<{ (14 * 22 + 7) / 8 }>;
type MD = U<{ (14 * 22usize).div_ceil(8) }>;
}
impl ParameterSet for Shake256s {
const NAME: &'static str = "SLH-DSA-SHAKE-256s";
Expand All @@ -258,7 +258,7 @@ impl HypertreeParams for Shake256f {
impl ForsParams for Shake256f {
type K = U<35>;
type A = U<9>;
type MD = U<{ (35 * 9 + 7) / 8 }>;
type MD = U<{ (35 * 9usize).div_ceil(8) }>;
}
impl ParameterSet for Shake256f {
const NAME: &'static str = "SLH-DSA-SHAKE-256f";
Expand Down
2 changes: 1 addition & 1 deletion slh-dsa/src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use hybrid_array::{Array, ArraySize, typenum::Unsigned};

// Algorithm 3
pub fn base_2b<OutLen: ArraySize, B: Unsigned>(x: &[u8]) -> Array<u16, OutLen> {
debug_assert!(x.len() >= (OutLen::USIZE * B::USIZE + 7) / 8);
debug_assert!(x.len() >= (OutLen::USIZE * B::USIZE).div_ceil(8));
debug_assert!(B::USIZE <= 16);

let mut bits = 0usize;
Expand Down