pub(super) fn mul_range(a: u64, b: u64) -> Nat {
        if a == 0 {
            Nat::from(0u32)
        } else if a > b {
            Nat::from(1u32)
        } else if a == b {
            Nat::from(a)
        } else {
            let mut res = Nat::from(b);
            let mut tmp_high = Nat::with_capacity(2);
            let tmp_low = Nat::with_capacity(2);
            for e in a..b {
                let (high, lower) = ((e >> 32) as u32, (e & (u32::MAX) as u64) as u32);
                Self::mul_add_ww(tmp_high.as_mut_vec(), res.as_slice(), high, 0);
                Self::mul_add_ww(tmp_low.as_mut_vec(), res.as_slice(), lower, 0);
                tmp_high.shl_inner(&32);
                
                let len = std::cmp::max(tmp_high.as_vec().len(), tmp_low.as_vec().len());
                tmp_high.as_mut_vec().resize(len, 0);
                tmp_low.as_mut_vec().resize(len, 0);
                res.as_mut_vec().resize(len, 0);
                let c = add_vv(res.as_mut_slice(), tmp_high.as_slice(), tmp_low.as_slice());
                res.as_mut_vec().push(c);
                res.trim_head_zero();
            }
            
            res
        }
    }
/// computes the product of all the unsigned integers in the
/// range [a, b] inclusively. If a > b (empty range), the result is 1.
computes the product of all the unsigned integers in the
range [a, b] inclusively. If a > b (empty range), the result is 1.
computes the product of all the unsigned integers in the range [ a b ] inclusively . If a > b ( empty range ) the result is 1 .
pub(super) fn mul_range(a: u64, b: u64) -> Nat {
        if a == 0 {
            Nat::from(0u32)
        } else if a > b {
            Nat::from(1u32)
        } else if a == b {
            Nat::from(a)
        } else {
            let mut res = Nat::from(b);
            let mut tmp_high = Nat::with_capacity(2);
            let tmp_low = Nat::with_capacity(2);
            for e in a..b {
                let (high, lower) = ((e >> 32) as u32, (e & (u32::MAX) as u64) as u32);
                Self::mul_add_ww(tmp_high.as_mut_vec(), res.as_slice(), high, 0);
                Self::mul_add_ww(tmp_low.as_mut_vec(), res.as_slice(), lower, 0);
                tmp_high.shl_inner(&32);
                let len = std::cmp::max(tmp_high.as_vec().len(), tmp_low.as_vec().len());
                tmp_high.as_mut_vec().resize(len, 0);
                tmp_low.as_mut_vec().resize(len, 0);
                res.as_mut_vec().resize(len, 0);
                let c = add_vv(res.as_mut_slice(), tmp_high.as_slice(), tmp_low.as_slice());
                res.as_mut_vec().push(c);
                res.trim_head_zero();
            }
            res
        }
    }
pub ( super ) fn mul_range ( a : u64 , b : u64 ) -> Nat { if a == 0 { Nat :: from ( 0u32 ) } else if a > b { Nat :: from ( 1u32 ) } else if a == b { Nat :: from ( a ) } else { let mut res = Nat :: from ( b ) ; let mut tmp_high = Nat :: with_capacity ( 2 ) ; let tmp_low = Nat :: with_capacity ( 2 ) ; for e in a .. b { let ( high , lower ) = ( ( e >> 32 ) as u32 , ( e & ( u32 :: MAX ) as u64 ) as u32 ) ; Self :: mul_add_ww ( tmp_high . as_mut_vec ( ) , res . as_slice ( ) , high , 0 ) ; Self :: mul_add_ww ( tmp_low . as_mut_vec ( ) , res . as_slice ( ) , lower , 0 ) ; tmp_high . shl_inner ( & 32 ) ; let len = std :: cmp :: max ( tmp_high . as_vec ( ) . len ( ) , tmp_low . as_vec ( ) . len ( ) ) ; tmp_high . as_mut_vec ( ) . resize ( len , 0 ) ; tmp_low . as_mut_vec ( ) . resize ( len , 0 ) ; res . as_mut_vec ( ) . resize ( len , 0 ) ; let c = add_vv ( res . as_mut_slice ( ) , tmp_high . as_slice ( ) , tmp_low . as_slice ( ) ) ; res . as_mut_vec ( ) . push ( c ) ; res . trim_head_zero ( ) ; } res } }
computes the product of all the unsigned integers in the
range [a, b] inclusively.
computes the product of all the unsigned integers in the range [ a b ] inclusively .
a
u64
b
u64
a
u64
b
u64