You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@fluo.apache.org by GitBox <gi...@apache.org> on 2017/10/19 07:57:09 UTC
[GitHub] kpm1985 opened a new issue #944: Refactor Bytes - Remove duplicate call to expensive function whos ret val is ignored
kpm1985 opened a new issue #944: Refactor Bytes - Remove duplicate call to expensive function whos ret val is ignored
URL: https://github.com/apache/fluo/issues/944
'''java
private int compareToUnchecked(byte[] bytes, int offset, int len) {
if (this.length == this.data.length && len == bytes.length) {
int res = UnsignedBytes.lexicographicalComparator().compare(this.data, bytes);
return UnsignedBytes.lexicographicalComparator().compare(this.data, bytes);
} else {
int minLen = Math.min(this.length, len);
for (int i = this.offset, j = offset; i < minLen; i++, j++) {
int a = (this.data[i] & 0xff);
int b = (bytes[j] & 0xff);
if (a != b) {
return a - b;
}
}
return this.length - len;
}
}
'''
Notice that the first block declares a variable and calls the function UnsignedBytes.lexicographicalComparator().compare(this.data, bytes); twice. This is an unintentional error I presume the author did not intend.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services