Add defense for builtin_clz/builtin_ctz in case that input is zero
This commit is contained in:
@ -80,6 +80,7 @@ void ObExprEstimateNdv::llc_estimate_ndv(int64_t& result, const ObString& bitmap
|
||||
}
|
||||
uint64_t ObExprEstimateNdv::llc_leading_zeros(uint64_t value, uint64_t bit_width)
|
||||
{
|
||||
OB_ASSERT(0ULL != value);
|
||||
return std::min(bit_width, static_cast<uint64_t>(__builtin_clzll(value)));
|
||||
}
|
||||
|
||||
|
||||
@ -126,8 +126,9 @@ public:
|
||||
|
||||
typedef bool (*is_type_func)(common::ObObjType type);
|
||||
|
||||
static constexpr int flag2bit(uint64_t flag)
|
||||
static int flag2bit(uint64_t flag)
|
||||
{
|
||||
OB_ASSERT(0ULL != flag);
|
||||
return static_cast<int>(__builtin_ctzll(flag));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user