yangzhg commented on a change in pull request #6625:
URL: https://github.com/apache/incubator-doris/pull/6625#discussion_r708970470



##########
File path: be/src/olap/hll.h
##########
@@ -162,35 +166,60 @@ class HyperLogLog {
     void _convert_explicit_to_register();
 
     // update one hash value into this registers
-    void _update_registers(uint64_t hash_value) {
+    inline void _update_registers(uint64_t hash_value) {
         // Use the lower bits to index into the number of streams and then
         // find the first 1 bit after the index bits.
         int idx = hash_value % HLL_REGISTERS_COUNT;
         hash_value >>= HLL_COLUMN_PRECISION;
         // make sure max first_one_bit is HLL_ZERO_COUNT_BITS + 1
         hash_value |= ((uint64_t)1 << HLL_ZERO_COUNT_BITS);
         uint8_t first_one_bit = __builtin_ctzl(hash_value) + 1;
-        _registers[idx] = std::max((uint8_t)_registers[idx], first_one_bit);
+        _registers[idx] = (_registers[idx] > first_one_bit ? _registers[idx] : 
first_one_bit);

Review comment:
       ```suggestion
           _registers[idx] = _registers[idx] > first_one_bit ? _registers[idx] 
: first_one_bit;
   ```




-- 
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]

Reply via email to