mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-28 15:24:43 +02:00
8331427: Rename confusingly named ArraysSupport.signedHashCode
Reviewed-by: redestad
This commit is contained in:
parent
44dc85001d
commit
4f529f8c23
1 changed files with 3 additions and 3 deletions
|
@ -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.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* 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,
|
public static int vectorizedHashCode(Object array, int fromIndex, int length, int initialValue,
|
||||||
int basicType) {
|
int basicType) {
|
||||||
return switch (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[]
|
case T_CHAR -> array instanceof byte[]
|
||||||
? utf16hashCode(initialValue, (byte[]) array, fromIndex, length)
|
? utf16hashCode(initialValue, (byte[]) array, fromIndex, length)
|
||||||
: hashCode(initialValue, (char[]) 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;
|
int end = fromIndex + length;
|
||||||
for (int i = fromIndex; i < end; i++) {
|
for (int i = fromIndex; i < end; i++) {
|
||||||
result = 31 * result + (a[i] & 0xff);
|
result = 31 * result + (a[i] & 0xff);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue