From 99410eab8d647954ba9b253ef4d686578e048dd3 Mon Sep 17 00:00:00 2001 From: "Mayeul@Zama" <69792125+mayeul-zama@users.noreply.github.com> Date: Wed, 9 Oct 2024 10:23:43 +0200 Subject: [PATCH] doc(core): add comment on PolynomialSize::log2 --- tfhe/src/core_crypto/commons/parameters.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tfhe/src/core_crypto/commons/parameters.rs b/tfhe/src/core_crypto/commons/parameters.rs index 6e648d234b..0eeb5cac3a 100644 --- a/tfhe/src/core_crypto/commons/parameters.rs +++ b/tfhe/src/core_crypto/commons/parameters.rs @@ -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 {