From 5da55a820ff93c4ddcd805c549cf5a1b3ba6ba22 Mon Sep 17 00:00:00 2001 From: Dag Lem Date: Sat, 9 Mar 2024 12:08:46 +0100 Subject: [PATCH] Replace calls to ceil(log2(x)) with ceil_log2(x) --- frontends/ast/simplify.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontends/ast/simplify.cc b/frontends/ast/simplify.cc index ea632e8b295..90724511c5b 100644 --- a/frontends/ast/simplify.cc +++ b/frontends/ast/simplify.cc @@ -2387,7 +2387,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin lsb_expr->children[stride_ix]->detectSignWidth(stride_width, stride_sign); shift_expr_width_max = std::max(i_width, stride_width); // Stride width calculated from actual stride value. - stride_width = std::ceil(std::log2(std::abs(stride))); + stride_width = ceil_log2(std::abs(stride)); if (i_width + stride_width > shift_expr_width_max) { // For (truncated) i*stride to be within the range of dst, the following must hold: @@ -3066,7 +3066,7 @@ bool AstNode::simplify(bool const_fold, int stage, int width_hint, bool sign_hin lsb_expr->children[stride_ix]->detectSignWidth(stride_width, stride_sign); max_width = std::max(i_width, stride_width); // Stride width calculated from actual stride value. - stride_width = std::ceil(std::log2(std::abs(stride))); + stride_width = ceil_log2(std::abs(stride)); if (i_width + stride_width > max_width) { // For (truncated) i*stride to be within the range of dst, the following must hold: