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
24 changes: 23 additions & 1 deletion src/uint/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ mod neg_mod;
#[cfg(feature = "rand_core")]
mod rand;

use crate::{Limb, NonZero, Uint, Word, Zero, U128, U64};
use crate::{Integer, Limb, NonZero, Uint, Word, Zero, U128, U64};
use alloc::{boxed::Box, vec, vec::Vec};
use core::fmt;
use subtle::{Choice, ConditionallySelectable, ConstantTimeEq};
Expand Down Expand Up @@ -403,6 +403,28 @@ impl<const LIMBS: usize> From<Uint<LIMBS>> for BoxedUint {
}
}

impl Integer for BoxedUint {
fn one() -> Self {
Self::one()
}

fn bits_precision(&self) -> usize {
self.bits_precision()
}

fn bytes_precision(&self) -> usize {
self.nlimbs() * Limb::BYTES
}

fn nlimbs(&self) -> usize {
self.nlimbs()
}

fn is_odd(&self) -> Choice {
self.is_odd()
}
}

impl Zero for BoxedUint {
fn zero() -> Self {
Self::zero()
Expand Down