HappenLee commented on code in PR #35394:
URL: https://github.com/apache/doris/pull/35394#discussion_r1616547713
##########
be/src/util/frame_of_reference_coding.h:
##########
@@ -34,9 +34,13 @@ inline uint8_t bits_less_than_64(const uint64_t v) {
// See
https://stackoverflow.com/questions/28423405/counting-the-number-of-leading-zeros-in-a-128-bit-integer
inline uint8_t bits_may_more_than_64(const uint128_t v) {
+ // See
https://stackoverflow.com/questions/49580083/builtin-clz-returns-incorrect-value-for-input-zero
+ if (v == 0) {
+ return 0;
+ }
uint64_t hi = v >> 64;
uint64_t lo = v;
- int z[3] = {__builtin_clzll(hi), __builtin_clzll(lo) + 64, 128};
+ int z[3] = {hi == 0 ? 64 : __builtin_clzll(hi), (lo == 0 ? 64 :
__builtin_clzll(lo)) + 64, 128};
Review Comment:
should be an inline function __builtin_clzll
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]