8332826: Make hashCode methods in ArraysSupport friendlier

Reviewed-by: redestad, liach
This commit is contained in:
Pavel Rappo 2024-05-30 09:33:30 +00:00
parent 2b4a4b7bd8
commit 3cff588a31
13 changed files with 234 additions and 80 deletions

View file

@ -585,11 +585,7 @@ final class StringUTF16 {
}
public static int hashCode(byte[] value) {
return switch (value.length) {
case 0 -> 0;
case 2 -> getChar(value, 0);
default -> ArraysSupport.vectorizedHashCode(value, 0, value.length >> 1, 0, ArraysSupport.T_CHAR);
};
return ArraysSupport.hashCodeOfUTF16(value, 0, value.length >> 1, 0);
}
// Caller must ensure that from- and toIndex are within bounds