Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1544,11 +1544,13 @@ private static void AddCustomAttributes(
else
{
int data = Unsafe.ReadUnaligned<int>((void*)blobStart);
#if BIGENDIAN
// Metadata is always written in little-endian format. Must account for this on
// big-endian platforms.
data = BinaryPrimitives.ReverseEndianness(data);
#endif
if (!BitConverter.IsLittleEndian)
{
// Metadata is always written in little-endian format. Must account for this on
// big-endian platforms.
data = BinaryPrimitives.ReverseEndianness(data);
}

const int CustomAttributeVersion = 0x0001;
if ((data & 0xffff) != CustomAttributeVersion)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,9 +884,11 @@ internal static unsafe int GetNonRandomizedHashCode(ReadOnlySpan<char> span)
case 3:
hash1 = BitOperations.RotateLeft(hash1, 5) + hash1 ^ Unsafe.ReadUnaligned<uint>(ptr);
uint p1 = *(char*)(ptr + 1);
#if BIGENDIAN
p1 <<= 16;
#endif
if (!BitConverter.IsLittleEndian)
{
p1 <<= 16;
}

hash2 = BitOperations.RotateLeft(hash2, 5) + hash2 ^ p1;
break;

Expand All @@ -896,9 +898,11 @@ internal static unsafe int GetNonRandomizedHashCode(ReadOnlySpan<char> span)

case 1:
uint p0 = *(char*)ptr;
#if BIGENDIAN
p0 <<= 16;
#endif
if (!BitConverter.IsLittleEndian)
{
p0 <<= 16;
}

hash2 = BitOperations.RotateLeft(hash2, 5) + hash2 ^ p0;
break;

Expand Down Expand Up @@ -998,9 +1002,11 @@ internal static unsafe int GetNonRandomizedHashCodeOrdinalIgnoreCase(ReadOnlySpa
case 3:
p0 = Unsafe.ReadUnaligned<uint>(ptr);
p1 = *(char*)(ptr + 1);
#if BIGENDIAN
p1 <<= 16;
#endif
if (!BitConverter.IsLittleEndian)
{
p1 <<= 16;
}

if (!Utf16Utility.AllCharsInUInt32AreAscii(p0 | p1))
{
goto NotAscii;
Expand All @@ -1022,9 +1028,11 @@ internal static unsafe int GetNonRandomizedHashCodeOrdinalIgnoreCase(ReadOnlySpa

case 1:
p0 = *(char*)ptr;
#if BIGENDIAN
p0 <<= 16;
#endif
if (!BitConverter.IsLittleEndian)
{
p0 <<= 16;
}

if (p0 > 0x7f)
{
goto NotAscii;
Expand Down