atoulme commented on code in PR #402:
URL: https://github.com/apache/incubator-tuweni/pull/402#discussion_r880659796


##########
bytes/src/main/java/org/apache/tuweni/bytes/ArrayWrappingBytes.java:
##########
@@ -162,4 +162,73 @@ public byte[] toArrayUnsafe() {
     }
     return toArray();
   }
+
+  @Override
+  public int bitLength() {
+    int size = size();
+    for (int i = 0; i < size; i++) {
+      byte b = bytes[i];
+      if (b == 0) continue;
+
+      return (size * 8) - (i * 8) - (Integer.numberOfLeadingZeros(b & 0xFF) - 
3 * 8);
+    }
+    return 0;
+  }
+
+  @Override
+  protected int computeHashcode() {
+    int result = 1;
+    int end = offset + length;
+    for (int i = offset; i < end; i++) {
+      result = 31 * result + bytes[i];
+    }
+    return result;
+  }
+
+  @Override
+  @SuppressWarnings("EqualsWrongThing") // ErrorProne does not consider 6 arg 
variants

Review Comment:
   D’oh. Shouldn’t comment late at night. 



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