We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
div_ceil
This can be emulated by calculating (N + M - 1) / M, but it results in bloated where blocks which obscure the original intention.
(N + M - 1) / M
where
The text was updated successfully, but these errors were encountered:
use core::ops::{Add, Div, Sub}; use typenum::op; pub type DivCeil<X, Y> = <X as DivCeiling<Y>>::Output; pub trait DivCeiling<Denom> { type Output; } impl<X: Integer, Y: Integer + NonZero> DivCeiling<Y> for X where X: Add<Y, Output: Sub<U1, Output: Div<Y>>>, { type Output = op!((X + Y - U1) / Y); }
now you should be able to use just DivCeiling as your bounds:
DivCeiling
trait Example<Y> { type Output; } impl<X: DivCeiling<Y>, Y> Example<Y> for X { type Output = DivCeil<X, Y>; }
Sorry, something went wrong.
No branches or pull requests
This can be emulated by calculating
(N + M - 1) / M
, but it results in bloatedwhere
blocks which obscure the original intention.The text was updated successfully, but these errors were encountered: