Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Update BitOperations callsites #35775

Closed
wants to merge 4 commits into from
Closed
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
2 changes: 1 addition & 1 deletion src/Common/src/System/Net/WebSockets/ManagedWebSocket.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1262,7 +1262,7 @@ private static unsafe int ApplyMask(Span<byte> toMask, int mask, int maskIndex)
Debug.Assert(maskIndex < sizeof(int));

int maskShift = maskIndex * 8;
int shiftedMask = (int)(((uint)mask >> maskShift) | ((uint)mask << (32 - maskShift)));
int shiftedMask = (int)BitOperations.RotateRight((uint)mask, maskShift);

// Try to use SIMD. We can if the number of bytes we're trying to mask is at least as much
// as the width of a vector and if the width is an even multiple of the mask.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ public sealed class MetadataSizes
public ImmutableArray<int> HeapSizes { get; }

/// <summary>
/// Table row counts.
/// Table row counts.
/// </summary>
public ImmutableArray<int> RowCounts { get; }

/// <summary>
/// External table row counts.
/// External table row counts.
/// </summary>
public ImmutableArray<int> ExternalRowCounts { get; }

Expand Down Expand Up @@ -363,7 +363,7 @@ internal int MetadataHeaderSize
MetadataVersionPaddedLength + // metadata version
sizeof(ushort) + // storage header: reserved
sizeof(ushort) + // stream count
(IsStandaloneDebugMetadata ? StandalonePdbStreamHeaderSize : 0) +
(IsStandaloneDebugMetadata ? StandalonePdbStreamHeaderSize : 0) +
RegularStreamHeaderSizes +
(IsEncDelta ? EncDeltaMarkerStreamHeaderSize : 0);
}
Expand Down Expand Up @@ -399,7 +399,7 @@ public int GetAlignedHeapSize(HeapIndex index)
internal int CalculateTableStreamHeaderSize()
{
int result = sizeof(int) + // Reserved
sizeof(short) + // Version (major, minor)
sizeof(short) + // Version (major, minor)
sizeof(byte) + // Heap index sizes
sizeof(byte) + // Bit width of RowId
sizeof(long) + // Valid table mask
Expand All @@ -421,7 +421,7 @@ internal int CalculateTableStreamHeaderSize()

internal int CalculateStandalonePdbStreamSize()
{
int result =
int result =
PdbIdSize + // PDB ID
sizeof(int) + // EntryPoint
sizeof(long) + // ReferencedTypeSystemTables
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public PEHeaderBuilder(

public static PEHeaderBuilder CreateExecutableHeader()
{
return new PEHeaderBuilder(imageCharacteristics : Characteristics.ExecutableImage);
return new PEHeaderBuilder(imageCharacteristics: Characteristics.ExecutableImage);
}

public static PEHeaderBuilder CreateLibraryHeader()
Expand All @@ -111,8 +111,8 @@ public static PEHeaderBuilder CreateLibraryHeader()
internal int ComputeSizeOfPEHeaders(int sectionCount) =>
PEBuilder.DosHeaderSize +
PEHeaders.PESignatureSize +
CoffHeader.Size +
PEHeader.Size(Is32Bit) +
CoffHeader.Size +
PEHeader.Size(Is32Bit) +
SectionHeader.Size * sectionCount;
}
}
}