You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by GitBox <gi...@apache.org> on 2022/10/20 06:03:29 UTC

[GitHub] [iotdb] FrankHWD opened a new pull request, #7669: [IOTDB-4633] Fix bugs of longToBytes in BytesUtils of tsfile

FrankHWD opened a new pull request, #7669:
URL: https://github.com/apache/iotdb/pull/7669

   Since I have met a problem of "unequal value after bytes transformation by BytesUtils in tsfile" as mentioned in IOTDB-4633. After modifying the right arithmetic shift (算术右移) to right logical shift (逻辑右移) in longToBytes function of BytesUtils in tsfile, the problem has been solved successfully.


-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] FrankHWD commented on a diff in pull request #7669: [IOTDB-4633] Fix bugs of longToBytes in BytesUtils of tsfile

Posted by GitBox <gi...@apache.org>.
FrankHWD commented on code in PR #7669:
URL: https://github.com/apache/iotdb/pull/7669#discussion_r1006562636


##########
tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BytesUtils.java:
##########
@@ -523,7 +523,7 @@ public static void longToBytes(long srcNum, byte[] result, int pos, int width) {
         width -= m;
         int mask = 1 << (8 - cnt);
         cnt += m;
-        byte y = (byte) (srcNum >> width);
+        byte y = (byte) (srcNum >>> width);

Review Comment:
   The UT tests for this bug have been added.



-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] HTHou commented on a diff in pull request #7669: [IOTDB-4633] Fix bugs of longToBytes in BytesUtils of tsfile

Posted by GitBox <gi...@apache.org>.
HTHou commented on code in PR #7669:
URL: https://github.com/apache/iotdb/pull/7669#discussion_r1002843377


##########
tsfile/src/main/java/org/apache/iotdb/tsfile/utils/BytesUtils.java:
##########
@@ -523,7 +523,7 @@ public static void longToBytes(long srcNum, byte[] result, int pos, int width) {
         width -= m;
         int mask = 1 << (8 - cnt);
         cnt += m;
-        byte y = (byte) (srcNum >> width);
+        byte y = (byte) (srcNum >>> width);

Review Comment:
   Add a UT for this bug?
   
   Besides, `intToBytes` seems have a same bug...



-- 
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: reviews-unsubscribe@iotdb.apache.org

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


[GitHub] [iotdb] HTHou merged pull request #7669: [IOTDB-4633] Fix bugs of longToBytes in BytesUtils of tsfile

Posted by GitBox <gi...@apache.org>.
HTHou merged PR #7669:
URL: https://github.com/apache/iotdb/pull/7669


-- 
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: reviews-unsubscribe@iotdb.apache.org

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