use core::ops::{Add, Div, Mul};
use num_traits::ConstOne;
#[inline(always)]
pub(crate) fn halve<N>(n: N) -> N
where
N: ConstOne + Add<Output = N> + Div<Output = N>,
{
let two = N::ONE + N::ONE;
n / two
}
#[inline(always)]
pub(crate) fn double<N>(n: N) -> N
where
N: Copy + Add<Output = N>,
{
n + n
}
#[inline(always)]
pub(crate) fn pow2<N>(n: N) -> N
where
N: Copy + Mul<Output = N>,
{
n * n
}