ademakov commented on code in PR #1287:
URL: https://github.com/apache/ignite-3/pull/1287#discussion_r1010189255


##########
modules/platforms/cpp/ignite/common/bits.h:
##########
@@ -161,9 +162,19 @@ T bit_ceil(T value) noexcept {
     // "Possible implementation" section here:
     // https://en.cppreference.com/w/cpp/numeric/bit_ceil
     // But do we really need this complication in our code? We can use 
somewhat relaxed
-    // rules as comapred to the standard library.
+    // rules as compared to the standard library.
     return value <= 1u ? 1u : T(1u) << bit_width(T(value - 1u));
 #endif
 }
 
+/**
+ * Get a number of bytes needed to store a specified number of bits of 
information.
+ *
+ * @param bits_num Number of bits to store.
+ * @return Required bytes number.
+ */
+[[nodiscard]] inline std::size_t bytes_for_bits(std::size_t bits_num) {
+    return bits_num ? ((bits_num - 1) / CHAR_BIT) + 1 : 0;

Review Comment:
   `return (bits_num + CHAR_BIT - 1) / CHAR_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]

Reply via email to