From befafb1d6e222232db9822bb76696ffc046f2a69 Mon Sep 17 00:00:00 2001 From: Martun Karapetyan Date: Wed, 11 Dec 2024 14:51:17 +0400 Subject: [PATCH] A small bug related to creation of evaluation domains of size 1. --- .../nil/crypto3/math/algorithms/make_evaluation_domain.hpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crypto3/libs/math/include/nil/crypto3/math/algorithms/make_evaluation_domain.hpp b/crypto3/libs/math/include/nil/crypto3/math/algorithms/make_evaluation_domain.hpp index e18ff409c7..9ad6011735 100644 --- a/crypto3/libs/math/include/nil/crypto3/math/algorithms/make_evaluation_domain.hpp +++ b/crypto3/libs/math/include/nil/crypto3/math/algorithms/make_evaluation_domain.hpp @@ -107,6 +107,12 @@ namespace nil { typedef std::shared_ptr> result_type; + // If m is 1, the value of (std::size_t(std::ceil(std::log2(m))) - 1) is -1, and stored in size_t it becomes a + // very large value. + if (m == 1) { + return result_type(); + } + const std::size_t big = 1ul << (std::size_t(std::ceil(std::log2(m))) - 1); const std::size_t rounded_small = (1ul << std::size_t(std::ceil(std::log2(m - big))));