Skip to content

Commit 39cfc20

Browse files
committed
bug fix attempt
1 parent 8124163 commit 39cfc20

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

src/libraries/System.Private.CoreLib/src/System/String.Comparison.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -839,12 +839,12 @@ internal unsafe int GetNonRandomizedHashCode()
839839
// if the input is less than a vector128 length, pad with trailing zero.
840840
uint[] arrWithPad = new uint[4];
841841

842-
for(int i = 0; i < length / 2; i++)
842+
for(int i = 0; i <= length / 2; i++)
843843
{
844844
arrWithPad[i] = ptr[i];
845845
}
846846

847-
for(int i = length; length < 4; length++)
847+
for(int i = length / 2 + 1; length < 4; length++)
848848
{
849849
arrWithPad[i] = 0;
850850
}
@@ -946,12 +946,12 @@ internal unsafe int GetNonRandomizedHashCodeOrdinalIgnoreCase()
946946
// if the input is less than a vector128 length, pad with trailing zero.
947947
uint[] arrWithPad = new uint[4];
948948

949-
for(int i = 0; i < length / 2; i++)
949+
for(int i = 0; i <= length / 2; i++)
950950
{
951951
arrWithPad[i] = ptr[i];
952952
}
953953

954-
for(int i = length; length < 4; length++)
954+
for(int i = length / 2 + 1; length < 4; length++)
955955
{
956956
arrWithPad[i] = 0;
957957
}

0 commit comments

Comments
 (0)