use super::*;
#[apply(nat_expr)]
pub type _LogUncheckedNormRec<B: NatExpr, N: NatExpr> = _LogUnchecked<
B,
crate::Eval<_DivUnchecked<N, B>>,
>;
#[apply(nat_expr)]
pub type _LogUnchecked<B: NatExpr, N: NatExpr> = If<
_Lt<N, B>,
crate::lit!(0),
_Inc<_LogUncheckedNormRec<B, N>>,
>;
#[apply(nat_expr)]
pub type _Log<B: NatExpr, N: NatExpr> = If<
_And<_H<B>, N>,
_LogUnchecked<B, N>,
crate::lit!(0),
>;
#[doc = op_examples!(
Log,
(5, 6) == 1,
(5, 4) == 0,
)]
#[doc = op_examples!(
Log,
(0, 10) == 0,
(1, 10) == 0,
(5, 0) == 0,
)]
#[apply(opaque)]
#[apply(test_op!
test_ilog,
N.ilog(B).into(),
2..,
1..,
)]
pub type Log<B, N> = _Log;
#[apply(nat_expr)]
pub type _BaseLen<B: NatExpr, N: NatExpr> = If<
_H<B>,
If<
N,
_Inc<_LogUnchecked<B, N>>,
crate::lit!(1),
>,
If<B, N, crate::lit!(0)>,
>;
#[apply(opaque)]
#[apply(test_op! test_base_len, {
let mut n = N;
let mut r = 1;
while n >= B {
r += 1;
n /= B;
}
r
}, 2..)]
#[doc = op_examples!(
BaseLen,
(10, 0) == 1,
(10, 10) == 2,
(10, 99) == 2,
)]
#[doc = op_examples!(
BaseLen,
(1, 3) == 3,
(1, 10) == 10,
)]
#[doc = op_examples!(
BaseLen,
(0, 0) == 0,
(0, 5) == 0,
)]
pub type BaseLen<B, N> = _BaseLen;