You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (Jira)" <ji...@apache.org> on 2023/04/25 19:26:00 UTC
[jira] [Commented] (IMPALA-12086) Fix BitUtil::CountLeadingZeros for zero
[ https://issues.apache.org/jira/browse/IMPALA-12086?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17716411#comment-17716411 ]
ASF subversion and git services commented on IMPALA-12086:
----------------------------------------------------------
Commit 5b0864d7b4a52169f9225f51caf1cfbac6272da2 in impala's branch refs/heads/master from Daniel Becker
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=5b0864d7b ]
IMPALA-12086: Fix BitUtil::CountLeadingZeros for zero
BitUtil::CountLeadingZeros() uses _builtin_clz() and _builtin_clzll() to
return the number of leading zeros in a number. Calling these functions
with 0 is undefined.
This change introduces a check in CountLeadingZeros() to only call these
functions if the argument is non-zero.
Also makes CountLeadingZeros() constexpr and restricts it to type sizes
that can actually be handled by the function.
Testing:
- Added a test for CountLeadingZeros() in bit-util-test.cc
Change-Id: I0ae3d84c5c25871388155747f91c51162c1a0590
Reviewed-on: http://gerrit.cloudera.org:8080/19792
Reviewed-by: Impala Public Jenkins <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>
> Fix BitUtil::CountLeadingZeros for zero
> ---------------------------------------
>
> Key: IMPALA-12086
> URL: https://issues.apache.org/jira/browse/IMPALA-12086
> Project: IMPALA
> Issue Type: Bug
> Components: Backend
> Reporter: Daniel Becker
> Assignee: Daniel Becker
> Priority: Major
> Fix For: Impala 4.3.0
>
>
> BitUtil::CountLeadingZeros uses {{builtin_clz()}} and {{_builtin_clzll()}} to return the number of zeros in a value. Calling these functions with 0 is undefined (see https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html), so CountLeadingZeros should check for zero and only call these functions if the argument is non-zero.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org