Skip to content

Commit

Permalink
Remove unused method and unnecessary local variables
Browse files Browse the repository at this point in the history
  • Loading branch information
pontusmelke committed Sep 7, 2018
1 parent 961813e commit bc19618
Showing 1 changed file with 2 additions and 33 deletions.
Expand Up @@ -397,9 +397,7 @@ public static int byteArrayCompare( byte[] value1, byte[] value2 )
public static int byteArrayCompare( byte[] value1, int value1Offset, int value1Length,
byte[] value2, int value2Offset, int value2Length )
{
int len1 = value1Length;
int len2 = value2Length;
int lim = Math.min( len1, len2 );
int lim = Math.min( value1Length, value2Length );
int i = 0;
while ( i < lim )
{
Expand All @@ -411,7 +409,7 @@ public static int byteArrayCompare( byte[] value1, int value1Offset, int value1L
}
i++;
}
return len1 - len2;
return value1Length - value2Length;
}

@Override
Expand All @@ -420,35 +418,6 @@ Matcher matcher( Pattern pattern )
return pattern.matcher( value() ); // TODO: can we do better here?
}

private static int codePointAt( byte[] bytes, int i )
{
assert i < bytes.length;
byte b = bytes[i];
if ( b >= 0 )
{
return b;
}
int bytesNeeded = 0;
while ( b < 0 )
{
bytesNeeded++;
b = (byte) (b << 1);
}
switch ( bytesNeeded )
{
case 2:
return (b << 4) | (bytes[i + 1] & HIGH_BIT_MASK);
case 3:
return (b << 9) | ((bytes[i + 1] & HIGH_BIT_MASK) << 6) | (bytes[i + 2] & HIGH_BIT_MASK);
case 4:
return (b << 14) | ((bytes[i + 1] & HIGH_BIT_MASK) << 12) |
((bytes[i + 2] & HIGH_BIT_MASK) << 6)
| (bytes[i + 3] & HIGH_BIT_MASK);
default:
throw new IllegalArgumentException( "Malformed UTF8 value " + bytesNeeded );
}
}

/**
* Returns the left-most index into the underlying byte array that does not belong to a whitespace code point
*/
Expand Down

0 comments on commit bc19618

Please sign in to comment.