From bc1961886b82ba043aaa8ca86c7f6cd7c65f03e2 Mon Sep 17 00:00:00 2001 From: Pontus Melke Date: Fri, 31 Aug 2018 17:01:08 +0200 Subject: [PATCH] Remove unused method and unnecessary local variables --- .../values/storable/UTF8StringValue.java | 35 ++----------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/community/values/src/main/java/org/neo4j/values/storable/UTF8StringValue.java b/community/values/src/main/java/org/neo4j/values/storable/UTF8StringValue.java index 347b0d3846301..f15e3c4d09ad3 100644 --- a/community/values/src/main/java/org/neo4j/values/storable/UTF8StringValue.java +++ b/community/values/src/main/java/org/neo4j/values/storable/UTF8StringValue.java @@ -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 ) { @@ -411,7 +409,7 @@ public static int byteArrayCompare( byte[] value1, int value1Offset, int value1L } i++; } - return len1 - len2; + return value1Length - value2Length; } @Override @@ -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 */