8331427: Rename confusingly named ArraysSupport.signedHashCode

Reviewed-by: redestad
This commit is contained in:
Pavel Rappo 2024-05-01 12:23:13 +00:00
parent 44dc85001d
commit 4f529f8c23

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2015, 2023, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@ -200,7 +200,7 @@ public class ArraysSupport {
public static int vectorizedHashCode(Object array, int fromIndex, int length, int initialValue,
int basicType) {
return switch (basicType) {
case T_BOOLEAN -> signedHashCode(initialValue, (byte[]) array, fromIndex, length);
case T_BOOLEAN -> unsignedHashCode(initialValue, (byte[]) array, fromIndex, length);
case T_CHAR -> array instanceof byte[]
? utf16hashCode(initialValue, (byte[]) array, fromIndex, length)
: hashCode(initialValue, (char[]) array, fromIndex, length);
@ -211,7 +211,7 @@ public class ArraysSupport {
};
}
private static int signedHashCode(int result, byte[] a, int fromIndex, int length) {
private static int unsignedHashCode(int result, byte[] a, int fromIndex, int length) {
int end = fromIndex + length;
for (int i = fromIndex; i < end; i++) {
result = 31 * result + (a[i] & 0xff);