Trait num_modular::DivExact

source ·
pub trait DivExact<Rhs, Precompute>: Sized {
    type Output;

    // Required method
    fn div_exact(self, d: Rhs, pre: &Precompute) -> Option<Self::Output>;
}
Expand description

Utility function for exact division, with precomputed helper values

Available Pre-computation types:

  • (): No pre-computation, the implementation relies on native integer division
  • PreModInv: With Pre-computed modular inverse

Required Associated Types§

Required Methods§

source

fn div_exact(self, d: Rhs, pre: &Precompute) -> Option<Self::Output>

Check if d divides self with the help of the precomputation. If d divides self, then the quotient is returned.

Implementations on Foreign Types§

source§

impl DivExact<u8, ()> for u8

§

type Output = u8

source§

fn div_exact(self, d: u8, _: &()) -> Option<Self::Output>

source§

impl DivExact<u32, PreModInv<u32>> for u32

§

type Output = u32

source§

fn div_exact(self, d: u32, pre: &PreModInv<u32>) -> Option<Self>

source§

impl DivExact<usize, PreModInv<usize>> for u128

§

type Output = u128

source§

fn div_exact(self, d: usize, pre: &PreModInv<usize>) -> Option<Self::Output>

source§

impl DivExact<u64, PreMulInv1by1<u64>> for u64

§

type Output = u64

source§

fn div_exact(self, d: u64, pre: &PreMulInv1by1<u64>) -> Option<Self::Output>

source§

impl DivExact<u8, PreMulInv1by1<u8>> for u8

§

type Output = u8

source§

fn div_exact(self, d: u8, pre: &PreMulInv1by1<u8>) -> Option<Self::Output>

source§

impl DivExact<usize, PreMulInv1by1<usize>> for usize

§

type Output = usize

source§

fn div_exact(self, d: usize, pre: &PreMulInv1by1<usize>) -> Option<Self::Output>

source§

impl DivExact<u64, PreModInv<u64>> for u128

§

type Output = u128

source§

fn div_exact(self, d: u64, pre: &PreModInv<u64>) -> Option<Self::Output>

source§

impl DivExact<u16, PreModInv<u16>> for u32

§

type Output = u32

source§

fn div_exact(self, d: u16, pre: &PreModInv<u16>) -> Option<Self::Output>

source§

impl DivExact<usize, PreModInv<usize>> for usize

§

type Output = usize

source§

fn div_exact(self, d: usize, pre: &PreModInv<usize>) -> Option<Self>

source§

impl DivExact<u8, PreModInv<u8>> for u16

§

type Output = u16

source§

fn div_exact(self, d: u8, pre: &PreModInv<u8>) -> Option<Self::Output>

source§

impl DivExact<u32, ()> for u32

§

type Output = u32

source§

fn div_exact(self, d: u32, _: &()) -> Option<Self::Output>

source§

impl DivExact<u16, ()> for u16

§

type Output = u16

source§

fn div_exact(self, d: u16, _: &()) -> Option<Self::Output>

source§

impl DivExact<u16, PreModInv<u16>> for u16

§

type Output = u16

source§

fn div_exact(self, d: u16, pre: &PreModInv<u16>) -> Option<Self>

source§

impl DivExact<u8, PreModInv<u8>> for u8

§

type Output = u8

source§

fn div_exact(self, d: u8, pre: &PreModInv<u8>) -> Option<Self>

source§

impl DivExact<u64, ()> for u64

§

type Output = u64

source§

fn div_exact(self, d: u64, _: &()) -> Option<Self::Output>

source§

impl DivExact<u32, PreMulInv1by1<u32>> for u32

§

type Output = u32

source§

fn div_exact(self, d: u32, pre: &PreMulInv1by1<u32>) -> Option<Self::Output>

source§

impl DivExact<u128, ()> for u128

§

type Output = u128

source§

fn div_exact(self, d: u128, _: &()) -> Option<Self::Output>

source§

impl DivExact<u32, PreModInv<u32>> for u64

§

type Output = u64

source§

fn div_exact(self, d: u32, pre: &PreModInv<u32>) -> Option<Self::Output>

source§

impl DivExact<u16, PreMulInv1by1<u16>> for u16

§

type Output = u16

source§

fn div_exact(self, d: u16, pre: &PreMulInv1by1<u16>) -> Option<Self::Output>

source§

impl DivExact<u64, PreModInv<u64>> for u64

§

type Output = u64

source§

fn div_exact(self, d: u64, pre: &PreModInv<u64>) -> Option<Self>

Implementors§