Vladsz83 commented on a change in pull request #9665:
URL: https://github.com/apache/ignite/pull/9665#discussion_r771861411



##########
File path: 
modules/core/src/main/java/org/apache/ignite/internal/cache/query/index/sorted/keys/BytesCompareUtils.java
##########
@@ -19,41 +19,24 @@
 
 /** */
 public final class BytesCompareUtils {
-    /** */
-    public static int compareNotNullSigned(byte[] arr0, byte[] arr1) {
-        if (arr0 == arr1)
-            return 0;
-        else {
-            int commonLen = Math.min(arr0.length, arr1.length);
-
-            for (int i = 0; i < commonLen; ++i) {
-                byte b0 = arr0[i];
-                byte b1 = arr1[i];
-
-                if (b0 != b1)
-                    return b0 > b1 ? 1 : -1;
-            }
-
-            return Integer.signum(arr0.length - arr1.length);
-        }
-    }
-
     /** */
     public static int compareNotNullUnsigned(byte[] arr0, byte[] arr1) {
         if (arr0 == arr1)
             return 0;
         else {
             int commonLen = Math.min(arr0.length, arr1.length);
+            int unSignArr0;
+            int unSignArr1;
 
             for (int i = 0; i < commonLen; ++i) {
-                int unSignArr0 = arr0[i] & 255;
-                int unSignArr1 = arr1[i] & 255;
+                unSignArr0 = arr0[i] & 255;
+                unSignArr1 = arr1[i] & 255;
 
                 if (unSignArr0 != unSignArr1)
                     return unSignArr0 > unSignArr1 ? 1 : -1;
             }
 
-            return Integer.signum(arr0.length - arr1.length);
+            return Integer.signum(Integer.compare(arr0.length, arr1.length));

Review comment:
       One more function call. Why? A trivial operator might be slightly faster.




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