Skip to content
Merged
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
7 changes: 4 additions & 3 deletions src/uint/mul.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

// TODO(tarcieri): use Karatsuba for better performance

use super::concat::concat_mixed;
use crate::{
Checked, CheckedMul, Concat, ConcatMixed, Limb, Uint, WideningMul, Wrapping, WrappingMul, Zero,
};
Expand Down Expand Up @@ -90,12 +91,12 @@ impl<const LIMBS: usize> Uint<LIMBS> {
}

/// Square self, returning a concatenated "wide" result.
pub fn square(&self) -> <Self as Concat>::Output
pub const fn square<const WIDE_LIMBS: usize>(&self) -> Uint<WIDE_LIMBS>
where
Self: Concat,
Self: Concat<Output = Uint<WIDE_LIMBS>>,
{
let (lo, hi) = self.square_wide();
hi.concat(&lo)
concat_mixed(&lo, &hi)
}

/// Square self, returning a "wide" result in two parts as (lo, hi).
Expand Down