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


##########
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:
   You added it 7 months ago when upgrading gradle - 
https://github.com/apache/incubator-tuweni/blob/main/build.gradle#L30



-- 
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: dev-unsubscr...@tuweni.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tuweni.apache.org
For additional commands, e-mail: dev-h...@tuweni.apache.org

Reply via email to