Skip to content

Commit

Permalink
8331427: Rename confusingly named ArraysSupport.signedHashCode
Browse files Browse the repository at this point in the history
Reviewed-by: redestad
  • Loading branch information
pavelrappo committed May 1, 2024
1 parent 44dc850 commit 4f529f8
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -200,7 +200,7 @@ public static int vectorizedMismatch(Object a, long aOffset,
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);
Expand All @@ -211,7 +211,7 @@ public static int vectorizedHashCode(Object array, int fromIndex, int length, in
};
}

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);
Expand Down

1 comment on commit 4f529f8

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.