You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@kvrocks.apache.org by GitBox <gi...@apache.org> on 2022/06/22 03:42:12 UTC

[GitHub] [incubator-kvrocks] ShooterIT commented on a diff in pull request #644: Refactor Trim/Split/Split2KV functions in util.h

ShooterIT commented on code in PR #644:
URL: https://github.com/apache/incubator-kvrocks/pull/644#discussion_r903253106


##########
src/util.cc:
##########
@@ -538,25 +550,29 @@ std::string StringToHex(const std::string &input) {
   return output;
 }
 
+constexpr std::uint64_t ExpTo1024(size_t n) {
+  return static_cast<std::uint64_t>(1) << (10 * n);
+}
+
 void BytesToHuman(char *buf, size_t size, uint64_t n) {
   double d;
 
-  if (n < 1024) {
+  if (n < ExpTo1024(1)) {

Review Comment:
   actually this code is copied from redis.
   but for this change, i don't feel it is clear, maybe we can define `KB MB GB TB PB`.
   
   And this change is not related to theme.



-- 
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: issues-unsubscribe@kvrocks.apache.org

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