Skip to content

Commit

Permalink
doc(core): add comment on PolynomialSize::log2
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeul-zama committed Oct 9, 2024
1 parent 8da31db commit ca2a9e0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion tfhe/src/core_crypto/commons/parameters.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,9 @@ pub struct PolynomialSize(pub usize);

impl PolynomialSize {
/// Return the associated [`PolynomialSizeLog`].
/// If the polynomial size is not a power of 2, returns the floor of its log2
pub fn log2(&self) -> PolynomialSizeLog {
PolynomialSizeLog((self.0 as f64).log2().ceil() as usize)
PolynomialSizeLog(self.0.ilog2() as usize)
}

pub fn to_fourier_polynomial_size(&self) -> FourierPolynomialSize {
Expand Down

0 comments on commit ca2a9e0

Please sign in to comment.