You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2020/08/17 01:59:57 UTC

[GitHub] [incubator-doris] ZhangYu0123 commented on a change in pull request #4366: Optimise coding bit operation in BE

ZhangYu0123 commented on a change in pull request #4366:
URL: https://github.com/apache/incubator-doris/pull/4366#discussion_r471195742



##########
File path: be/src/util/coding.h
##########
@@ -143,7 +143,7 @@ extern uint8_t* encode_varint64(uint8_t* dst, uint64_t value);
 inline uint8_t* encode_varint64(uint8_t* dst, uint64_t v) {
     static const unsigned int B = 128;
     while (v >= B) {
-        *(dst++) = (v & (B - 1)) | B;
+        *(dst++) = v | B;

Review comment:
       (v & (B-1)) | B = (v | B) & ((B-1) | B ) = (v | B) & (11111111) = v | B
    
   eg: 
   129 & (128 - 1)  | 128 = 1
   129 | 128 =  1




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

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org