github-actions[bot] commented on code in PR #25700:
URL: https://github.com/apache/doris/pull/25700#discussion_r1366778153


##########
be/src/vec/common/pod_array.h:
##########
@@ -47,6 +46,23 @@
 
 namespace doris::vectorized {
 
+/** For zero argument, result is zero.
+  * For arguments with most significand bit set, result is zero.
+  * For other arguments, returns value, rounded up to power of two.
+  */
+inline size_t round_up_to_power_of_two_or_zero(size_t n) {
+    --n;
+    n |= n >> 1;
+    n |= n >> 2;
+    n |= n >> 4;
+    n |= n >> 8;
+    n |= n >> 16;
+    n |= n >> 32;

Review Comment:
   warning: 32 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
       n |= n >> 32;
                 ^
   ```
   



##########
be/src/vec/common/pod_array.h:
##########
@@ -47,6 +46,23 @@
 
 namespace doris::vectorized {
 
+/** For zero argument, result is zero.
+  * For arguments with most significand bit set, result is zero.
+  * For other arguments, returns value, rounded up to power of two.
+  */
+inline size_t round_up_to_power_of_two_or_zero(size_t n) {
+    --n;
+    n |= n >> 1;
+    n |= n >> 2;
+    n |= n >> 4;
+    n |= n >> 8;
+    n |= n >> 16;

Review Comment:
   warning: 16 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
       n |= n >> 16;
                 ^
   ```
   



##########
be/src/vec/common/pod_array.h:
##########
@@ -47,6 +46,23 @@
 
 namespace doris::vectorized {
 
+/** For zero argument, result is zero.
+  * For arguments with most significand bit set, result is zero.
+  * For other arguments, returns value, rounded up to power of two.
+  */
+inline size_t round_up_to_power_of_two_or_zero(size_t n) {
+    --n;
+    n |= n >> 1;
+    n |= n >> 2;
+    n |= n >> 4;
+    n |= n >> 8;

Review Comment:
   warning: 8 is a magic number; consider replacing it with a named constant 
[readability-magic-numbers]
   ```cpp
       n |= n >> 8;
                 ^
   ```
   



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