505 references to BitOperations
GenerateDocumentationAndConfigFiles (2)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (1)
1269return BitOperations.Log2(value);
src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
175return System.Numerics.BitOperations.Log2((uint)((Threshold / elementSize) - (2 * Unsafe.SizeOf<object>() + 8)));
http2cat (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
IIS.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
IIS.LongTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
IIS.NewHandler.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
IIS.NewShim.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
IISExpress.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
Microsoft.AspNetCore.DataProtection (1)
src\Shared\Encoding\Int7BitEncodingUtils.cs (1)
20return ((31 - System.Numerics.BitOperations.LeadingZeroCount(value | 1)) / 7) + 1;
Microsoft.AspNetCore.HttpLogging (17)
W3CLoggingMiddleware.cs (17)
25internal static readonly int _dateIndex = BitOperations.Log2((int)W3CLoggingFields.Date); 26internal static readonly int _timeIndex = BitOperations.Log2((int)W3CLoggingFields.Time); 27internal static readonly int _clientIpIndex = BitOperations.Log2((int)W3CLoggingFields.ClientIpAddress); 28internal static readonly int _userNameIndex = BitOperations.Log2((int)W3CLoggingFields.UserName); 29internal static readonly int _serverNameIndex = BitOperations.Log2((int)W3CLoggingFields.ServerName); 30internal static readonly int _serverIpIndex = BitOperations.Log2((int)W3CLoggingFields.ServerIpAddress); 31internal static readonly int _serverPortIndex = BitOperations.Log2((int)W3CLoggingFields.ServerPort); 32internal static readonly int _methodIndex = BitOperations.Log2((int)W3CLoggingFields.Method); 33internal static readonly int _uriStemIndex = BitOperations.Log2((int)W3CLoggingFields.UriStem); 34internal static readonly int _uriQueryIndex = BitOperations.Log2((int)W3CLoggingFields.UriQuery); 35internal static readonly int _protocolStatusIndex = BitOperations.Log2((int)W3CLoggingFields.ProtocolStatus); 36internal static readonly int _timeTakenIndex = BitOperations.Log2((int)W3CLoggingFields.TimeTaken); 37internal static readonly int _protocolVersionIndex = BitOperations.Log2((int)W3CLoggingFields.ProtocolVersion); 38internal static readonly int _hostIndex = BitOperations.Log2((int)W3CLoggingFields.Host); 39internal static readonly int _userAgentIndex = BitOperations.Log2((int)W3CLoggingFields.UserAgent); 40internal static readonly int _cookieIndex = BitOperations.Log2((int)W3CLoggingFields.Cookie); 41internal static readonly int _refererIndex = BitOperations.Log2((int)W3CLoggingFields.Referer);
Microsoft.AspNetCore.Server.HttpSys.FunctionalTests (2)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
Microsoft.AspNetCore.Server.Kestrel.Core (22)
Internal\Http\HttpHeaders.Generated.cs (17)
2586return (_contentLength.HasValue ? 1 : 0 ) + BitOperations.PopCount((ulong)_bits) + (MaybeUnknown?.Count ?? 0); 8664_next = BitOperations.TrailingZeroCount(_currentBits); 8678? BitOperations.TrailingZeroCount(bits) 10872return (_contentLength.HasValue ? 1 : 0 ) + BitOperations.PopCount((ulong)_bits) + (MaybeUnknown?.Count ?? 0); 14053if(BitOperations.PopCount((ulong)tempBits) > 12) 14813var next = BitOperations.TrailingZeroCount(tempBits); 14840next = BitOperations.TrailingZeroCount(tempBits); 14866next = BitOperations.TrailingZeroCount(tempBits); 14885next = BitOperations.TrailingZeroCount(tempBits); 14967next = BitOperations.TrailingZeroCount(tempBits); 15112next = BitOperations.TrailingZeroCount(tempBits); 15192next = BitOperations.TrailingZeroCount(tempBits); 15500_next = BitOperations.TrailingZeroCount(_currentBits); 15514? BitOperations.TrailingZeroCount(bits) 17169return (_contentLength.HasValue ? 1 : 0 ) + BitOperations.PopCount((ulong)_bits) + (MaybeUnknown?.Count ?? 0); 17486if(BitOperations.PopCount((ulong)tempBits) > 12) 17621_next = BitOperations.TrailingZeroCount(_currentBits);
Internal\Http\HttpResponseTrailers.cs (2)
63_next = _currentBits != 0 ? BitOperations.TrailingZeroCount(_currentBits) : -1; 85_next = _currentBits != 0 ? BitOperations.TrailingZeroCount(_currentBits) : -1;
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (1)
434switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
Microsoft.AspNetCore.Shared.Tests (3)
src\Shared\runtime\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\Shared\runtime\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
src\Shared\runtime\Http3\QPack\QPackDecoder.cs (1)
434switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
Microsoft.CodeAnalysis (2)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (1)
1269return BitOperations.Log2(value);
src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
175return System.Numerics.BitOperations.Log2((uint)((Threshold / elementSize) - (2 * Unsafe.SizeOf<object>() + 8)));
Microsoft.CodeAnalysis.Collections.Package (2)
Internal\ArraySortHelper.cs (1)
1269return BitOperations.Log2(value);
Internal\SegmentedArrayHelper.cs (1)
175return System.Numerics.BitOperations.Log2((uint)((Threshold / elementSize) - (2 * Unsafe.SizeOf<object>() + 8)));
Microsoft.CodeAnalysis.Workspaces (2)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (1)
1269return BitOperations.Log2(value);
src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
175return System.Numerics.BitOperations.Log2((uint)((Threshold / elementSize) - (2 * Unsafe.SizeOf<object>() + 8)));
Microsoft.CodeAnalysis.Workspaces.MSBuild.BuildHost (2)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (1)
1269return BitOperations.Log2(value);
src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
175return System.Numerics.BitOperations.Log2((uint)((Threshold / elementSize) - (2 * Unsafe.SizeOf<object>() + 8)));
Microsoft.NET.StringTools (1)
InternableString.cs (1)
391return System.Numerics.BitOperations.RotateLeft(value, offset);
System.Collections (1)
System\Collections\Generic\SortedSet.cs (1)
2014private static int Log2(int value) => BitOperations.Log2((uint)value);
System.Collections.Immutable (22)
System\Collections\Frozen\String\Hashing.cs (22)
34hash2 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ src[0]; 38hash2 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ src[0]; 39hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ src[1]; 43hash2 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ src[0]; 44hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ src[1]; 45hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ src[2]; 49hash1 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ ((uint*)src)[0]; 50hash2 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ ((uint*)src)[1]; 60hash1 = (BitOperations.RotateLeft(hash1, 5) + hash1) ^ ptrUInt32[0]; 61hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ ptrUInt32[1]; 69hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ *ptrChar++; 98hash2 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ (src[0] | LowercaseChar); 102hash2 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ (src[0] | LowercaseChar); 103hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (src[1] | LowercaseChar); 107hash2 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ (src[0] | LowercaseChar); 108hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (src[1] | LowercaseChar); 109hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (src[2] | LowercaseChar); 113hash1 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ (((uint*)src)[0] | LowercaseUInt32); 114hash2 = (BitOperations.RotateLeft(Hash1Start, 5) + Hash1Start) ^ (((uint*)src)[1] | LowercaseUInt32); 124hash1 = (BitOperations.RotateLeft(hash1, 5) + hash1) ^ (ptrUInt32[0] | LowercaseUInt32); 125hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (ptrUInt32[1] | LowercaseUInt32); 133hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (*ptrChar | LowercaseUInt32);
System.Collections.Specialized (2)
System\Collections\Specialized\BitVector32.cs (2)
141short offset = (short)(priorOffset + BitOperations.PopCount((uint)(ushort)priorMask)); 147short mask = (short)(BitOperations.RoundUpToPowerOf2((uint)(ushort)maxValue + 1) - 1);
System.Diagnostics.DiagnosticSource (1)
System\Diagnostics\Metrics\Base2ExponentialHistogramAggregator.cs (1)
283return BitOperations.LeadingZeroCount((ulong)value);
System.IO.Hashing (18)
System\IO\Hashing\XxHash128.cs (1)
266uint combinedh = BitOperations.RotateLeft(BinaryPrimitives.ReverseEndianness(combinedl), 13);
System\IO\Hashing\XxHash32.State.cs (7)
54BitOperations.RotateLeft(_acc1, 1) + 55BitOperations.RotateLeft(_acc2, 7) + 56BitOperations.RotateLeft(_acc3, 12) + 57BitOperations.RotateLeft(_acc4, 18); 63acc = BitOperations.RotateLeft(acc, 13); 79acc = BitOperations.RotateLeft(acc, 17); 89acc = BitOperations.RotateLeft(acc, 11);
System\IO\Hashing\XxHash64.State.cs (8)
73BitOperations.RotateLeft(_acc1, 1) + 74BitOperations.RotateLeft(_acc2, 7) + 75BitOperations.RotateLeft(_acc3, 12) + 76BitOperations.RotateLeft(_acc4, 18); 94acc = BitOperations.RotateLeft(acc, 31); 114acc = BitOperations.RotateLeft(acc, 27); 126acc = BitOperations.RotateLeft(acc, 23); 137acc = BitOperations.RotateLeft(acc, 11);
System\IO\Hashing\XxHashShared.cs (2)
195hash ^= BitOperations.RotateLeft(hash, 49) ^ BitOperations.RotateLeft(hash, 24);
System.Linq.Expressions (1)
System\Dynamic\Utils\CacheDict.cs (1)
44int alignedSize = (int)BitOperations.RoundUpToPowerOf2((uint)size);
System.Net.Http (3)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\HPackDecoder.cs (1)
319switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
src\libraries\Common\src\System\Net\Http\aspnetcore\Http2\Hpack\IntegerDecoder.cs (1)
71if (BitOperations.LeadingZeroCount((uint)b) <= _m)
src\libraries\Common\src\System\Net\Http\aspnetcore\Http3\QPack\QPackDecoder.cs (1)
434switch (BitOperations.LeadingZeroCount(b) - 24) // byte 'b' is extended to uint, so will have 24 extra 0s.
System.Net.Security (3)
src\libraries\Common\src\System\Net\Security\MD4.cs (3)
158a = BitOperations.RotateLeft(a, s); 164a = BitOperations.RotateLeft(a, s); 170a = BitOperations.RotateLeft(a, s);
System.Net.WebSockets (2)
System\Net\WebSockets\ManagedWebSocket.cs (2)
1667(int)BitOperations.RotateRight((uint)mask, maskIndex * 8) : 1668(int)BitOperations.RotateLeft((uint)mask, maskIndex * 8);
System.Numerics.Tensors (9)
System\Numerics\Tensors\netcore\TensorPrimitives.HammingDistance.cs (6)
91count += BitOperations.PopCount((~Vector512.Equals(xVec, yVec)).ExtractMostSignificantBits()); 107count += BitOperations.PopCount((~Vector512.Equals(xVec, yVec)).ExtractMostSignificantBits()); 123count += BitOperations.PopCount((~Vector256.Equals(xVec, yVec)).ExtractMostSignificantBits()); 139count += BitOperations.PopCount((~Vector256.Equals(xVec, yVec)).ExtractMostSignificantBits()); 156count += BitOperations.PopCount((~Vector128.Equals(xVec, yVec)).ExtractMostSignificantBits()); 172count += BitOperations.PopCount((~Vector128.Equals(xVec, yVec)).ExtractMostSignificantBits());
System\Numerics\Tensors\netcore\TensorPrimitives.IndexOfMax.cs (3)
444BitOperations.TrailingZeroCount(mask.ExtractMostSignificantBits()); 447BitOperations.TrailingZeroCount(mask.ExtractMostSignificantBits()); 450BitOperations.TrailingZeroCount(mask.ExtractMostSignificantBits());
System.Private.CoreLib (330)
src\libraries\Common\src\Internal\VersionResilientHashCode.cs (2)
118return (int)BitOperations.RotateLeft((uint)value, bitCount); 130return (BitOperations.RotateLeft((hash + queuedValue * 3266489917U/*Prime3*/), 17)) * 668265263U/*Prime4*/;
src\libraries\Common\src\System\Sha1ForNonSecretPurposes.cs (9)
112_w[i] = BitOperations.RotateLeft(_w[i - 3] ^ _w[i - 8] ^ _w[i - 14] ^ _w[i - 16], 1); 125uint temp = BitOperations.RotateLeft(a, 5) + f + e + k + _w[i]; e = d; d = c; c = BitOperations.RotateLeft(b, 30); b = a; a = temp; 132uint temp = BitOperations.RotateLeft(a, 5) + f + e + k + _w[i]; e = d; d = c; c = BitOperations.RotateLeft(b, 30); b = a; a = temp; 139uint temp = BitOperations.RotateLeft(a, 5) + f + e + k + _w[i]; e = d; d = c; c = BitOperations.RotateLeft(b, 30); b = a; a = temp; 146uint temp = BitOperations.RotateLeft(a, 5) + f + e + k + _w[i]; e = d; d = c; c = BitOperations.RotateLeft(b, 30); b = a; a = temp;
src\libraries\System.Private.CoreLib\src\System\Array.cs (2)
2687IntroSort(left, length + left - 1, 2 * (BitOperations.Log2((uint)length) + 1)); 2904IntroSort(left, length + left - 1, 2 * (BitOperations.Log2((uint)length) + 1));
src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReverseEndianness.cs (2)
150return BitOperations.RotateRight(value & 0x00FF00FFu, 8) // xx zz 151+ BitOperations.RotateLeft(value & 0xFF00FF00u, 8); // ww yy
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (1)
112return (BitOperations.Log2(value) >> 2) + 1;
src\libraries\System.Private.CoreLib\src\System\Buffers\Utilities.cs (1)
20return BitOperations.Log2((uint)bufferSize - 1 | 15) - 3;
src\libraries\System.Private.CoreLib\src\System\Byte.cs (5)
282public static byte LeadingZeroCount(byte value) => (byte)(BitOperations.LeadingZeroCount(value) - 24); 285public static byte PopCount(byte value) => (byte)BitOperations.PopCount(value); 294public static byte TrailingZeroCount(byte value) => (byte)(BitOperations.TrailingZeroCount(value << 24) - 24); 412public static bool IsPow2(byte value) => BitOperations.IsPow2((uint)value); 415public static byte Log2(byte value) => (byte)BitOperations.Log2(value);
src\libraries\System.Private.CoreLib\src\System\Char.cs (3)
1196static char IBinaryInteger<char>.LeadingZeroCount(char value) => (char)(BitOperations.LeadingZeroCount(value) - 16); 1199static char IBinaryInteger<char>.PopCount(char value) => (char)BitOperations.PopCount(value); 1208static char IBinaryInteger<char>.TrailingZeroCount(char value) => (char)(BitOperations.TrailingZeroCount(value << 16) - 16);
src\libraries\System.Private.CoreLib\src\System\Collections\Concurrent\ConcurrentQueue.cs (1)
97length = (int)Math.Min(BitOperations.RoundUpToPowerOf2((uint)count), MaxSegmentLength);
src\libraries\System.Private.CoreLib\src\System\Collections\Concurrent\ConcurrentQueueSegment.cs (1)
49Debug.Assert(BitOperations.IsPow2(boundedLength), $"Must be a power of 2, got {boundedLength}");
src\libraries\System.Private.CoreLib\src\System\Collections\Generic\ArraySortHelper.cs (4)
127IntroSort(keys, 2 * (BitOperations.Log2((uint)keys.Length) + 1), comparer); 306IntroSort(keys, 2 * (BitOperations.Log2((uint)keys.Length) + 1)); 673IntroSort(keys, values, 2 * (BitOperations.Log2((uint)keys.Length) + 1), comparer); 858IntroSort(keys, values, 2 * (BitOperations.Log2((uint)keys.Length) + 1));
src\libraries\System.Private.CoreLib\src\System\Decimal.DecCalc.cs (3)
623newScale -= BitOperations.LeadingZeroCount(result[hiRes]); 2034curScale = BitOperations.LeadingZeroCount(tmp); 2307int shift = BitOperations.LeadingZeroCount(tmp);
src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventSource.cs (1)
5725if (isbitmap && !BitOperations.IsPow2(hexValue))
src\libraries\System.Private.CoreLib\src\System\Globalization\Ordinal.cs (4)
515mask = BitOperations.ResetLowestSetBit(BitOperations.ResetLowestSetBit(mask)); 581mask = BitOperations.ResetLowestSetBit(BitOperations.ResetLowestSetBit(mask));
src\libraries\System.Private.CoreLib\src\System\Half.cs (2)
1105int shiftDist = BitOperations.LeadingZeroCount(sig) - 16 - 5; 1539return MinExponent - (BitOperations.LeadingZeroCount(x.TrailingSignificand) - BiasedExponentLength);
src\libraries\System.Private.CoreLib\src\System\HashCode.cs (6)
271return BitOperations.RotateLeft(hash + input * Prime2, 13) * Prime1; 277return BitOperations.RotateLeft(hash + queuedValue * Prime3, 17) * Prime4; 283return BitOperations.RotateLeft(v1, 1) + BitOperations.RotateLeft(v2, 7) + BitOperations.RotateLeft(v3, 12) + BitOperations.RotateLeft(v4, 18);
src\libraries\System.Private.CoreLib\src\System\Int128.cs (2)
724return 64 + BitOperations.LeadingZeroCount(value._lower); 726return BitOperations.LeadingZeroCount(value._upper);
src\libraries\System.Private.CoreLib\src\System\Int16.cs (5)
285public static short LeadingZeroCount(short value) => (short)(BitOperations.LeadingZeroCount((ushort)value) - 16); 288public static short PopCount(short value) => (short)BitOperations.PopCount((ushort)value); 297public static short TrailingZeroCount(short value) => (byte)(BitOperations.TrailingZeroCount(value << 16) - 16); 499public static bool IsPow2(short value) => BitOperations.IsPow2(value); 508return (short)BitOperations.Log2((ushort)value);
src\libraries\System.Private.CoreLib\src\System\Int32.cs (7)
301public static int LeadingZeroCount(int value) => BitOperations.LeadingZeroCount((uint)value); 305public static int PopCount(int value) => BitOperations.PopCount((uint)value); 309public static int RotateLeft(int value, int rotateAmount) => (int)BitOperations.RotateLeft((uint)value, rotateAmount); 313public static int RotateRight(int value, int rotateAmount) => (int)BitOperations.RotateRight((uint)value, rotateAmount); 317public static int TrailingZeroCount(int value) => BitOperations.TrailingZeroCount(value); 538public static bool IsPow2(int value) => BitOperations.IsPow2(value); 549return BitOperations.Log2((uint)value);
src\libraries\System.Private.CoreLib\src\System\Int64.cs (9)
298public static long LeadingZeroCount(long value) => BitOperations.LeadingZeroCount((ulong)value); 302public static long PopCount(long value) => BitOperations.PopCount((ulong)value); 306public static long RotateLeft(long value, int rotateAmount) => (long)BitOperations.RotateLeft((ulong)value, rotateAmount); 310public static long RotateRight(long value, int rotateAmount) => (long)BitOperations.RotateRight((ulong)value, rotateAmount); 314public static long TrailingZeroCount(long value) => BitOperations.TrailingZeroCount(value); 490return (sizeof(long) * 8) - BitOperations.LeadingZeroCount((ulong)(value)); 494return (sizeof(long) * 8) + 1 - BitOperations.LeadingZeroCount((ulong)(~value)); 535public static bool IsPow2(long value) => BitOperations.IsPow2(value); 546return BitOperations.Log2((ulong)value);
src\libraries\System.Private.CoreLib\src\System\IntPtr.cs (9)
303public static nint LeadingZeroCount(nint value) => BitOperations.LeadingZeroCount((nuint)value); 307public static nint PopCount(nint value) => BitOperations.PopCount((nuint)value); 311public static nint RotateLeft(nint value, int rotateAmount) => (nint)BitOperations.RotateLeft((nuint)value, rotateAmount); 315public static nint RotateRight(nint value, int rotateAmount) => (nint)BitOperations.RotateRight((nuint)value, rotateAmount); 319public static nint TrailingZeroCount(nint value) => BitOperations.TrailingZeroCount(value); 495return (sizeof(nint_t) * 8) - BitOperations.LeadingZeroCount((nuint)value); 499return (sizeof(nint_t) * 8) + 1 - BitOperations.LeadingZeroCount((nuint)(~value)); 540public static bool IsPow2(nint value) => BitOperations.IsPow2(value); 551return BitOperations.Log2((nuint)value);
src\libraries\System.Private.CoreLib\src\System\Marvin.cs (1)
10using static System.Numerics.BitOperations;
src\libraries\System.Private.CoreLib\src\System\Math.cs (1)
898return double.MinExponent - (BitOperations.LeadingZeroCount(x.TrailingSignificand) - double.BiasedExponentLength);
src\libraries\System.Private.CoreLib\src\System\MathF.cs (1)
213return float.MinExponent - (BitOperations.LeadingZeroCount(x.TrailingSignificand) - float.BiasedExponentLength);
src\libraries\System.Private.CoreLib\src\System\Number.BigInteger.cs (3)
424return 32 - (uint)BitOperations.LeadingZeroCount(value); 429return 64 - (uint)BitOperations.LeadingZeroCount(value); 523int shiftLeft = BitOperations.LeadingZeroCount(divHi);
src\libraries\System.Private.CoreLib\src\System\Number.DiyFp.cs (1)
93int lzcnt = BitOperations.LeadingZeroCount(f);
src\libraries\System.Private.CoreLib\src\System\Number.Dragon4.cs (2)
34mantissaHighBitIdx = (uint)BitOperations.Log2(mantissa); 283uint hiBlockLog2 = (uint)BitOperations.Log2(hiBlock);
src\libraries\System.Private.CoreLib\src\System\Number.NumberToFloatingPointBits.cs (1)
1294int lz = BitOperations.LeadingZeroCount(w);
src\libraries\System.Private.CoreLib\src\System\Random.CompatImpl.cs (2)
72int bits = BitOperations.Log2Ceiling(exclusiveRange); 195int bits = BitOperations.Log2Ceiling(exclusiveRange);
src\libraries\System.Private.CoreLib\src\System\Random.cs (2)
215if (BitOperations.IsPow2(choices.Length)) 247int mask = (int)BitOperations.RoundUpToPowerOf2((uint)choices.Length) - 1;
src\libraries\System.Private.CoreLib\src\System\Random.Xoshiro256StarStarImpl.cs (6)
57ulong result = BitOperations.RotateLeft(s1 * 5, 7) * 9; 66s3 = BitOperations.RotateLeft(s3, 45); 142MemoryMarshal.Write(buffer, BitOperations.RotateLeft(s1 * 5, 7) * 9); 151s3 = BitOperations.RotateLeft(s3, 45); 158ulong next = BitOperations.RotateLeft(s1 * 5, 7) * 9; 173s3 = BitOperations.RotateLeft(s3, 45);
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\CastCache.cs (4)
39Debug.Assert(BitOperations.PopCount((uint)initialCacheSize) == 1 && initialCacheSize > 1); 40Debug.Assert(BitOperations.PopCount((uint)maxCacheSize) == 1 && maxCacheSize >= initialCacheSize); 95nuint hash = BitOperations.RotateLeft(source, (nuint.Size * 8) / 2) ^ target; 253byte shift = (byte)BitOperations.LeadingZeroCount((nuint)(size - 1));
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\ConditionalWeakTable.cs (3)
569Debug.Assert(BitOperations.IsPow2(InitialCapacity)); 592Debug.Assert(BitOperations.IsPow2(buckets.Length)); 797Debug.Assert(BitOperations.IsPow2(newSize));
src\libraries\System.Private.CoreLib\src\System\Runtime\CompilerServices\GenericCache.cs (3)
77Debug.Assert(BitOperations.PopCount((uint)initialCacheSize) == 1 && initialCacheSize > 1); 78Debug.Assert(BitOperations.PopCount((uint)maxCacheSize) == 1 && maxCacheSize >= initialCacheSize); 235byte shift = (byte)BitOperations.LeadingZeroCount((nuint)(size - 1));
src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NativeMemory.Unix.cs (2)
26if (!BitOperations.IsPow2(alignment)) 87if (!BitOperations.IsPow2(alignment))
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.cs (3)
770public static int Count<T>(Vector128<T> vector, T value) => BitOperations.PopCount(Equals(vector, Create(value)).ExtractMostSignificantBits()); 1852int result = BitOperations.TrailingZeroCount(Equals(vector, Create(value)).ExtractMostSignificantBits()); 2085public static int LastIndexOf<T>(Vector128<T> vector, T value) => 31 - BitOperations.LeadingZeroCount(Equals(vector, Create(value)).ExtractMostSignificantBits());
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector128.Numerics.cs (12)
228internal static int Count(Vector2 vector, float value) => BitOperations.PopCount(Equals(vector.AsVector128(), Create(value, value, -1, -1)).ExtractMostSignificantBits()); 233internal static int Count(Vector3 vector, float value) => BitOperations.PopCount(Equals(vector.AsVector128(), Create(value, value, value, -1)).ExtractMostSignificantBits()); 238internal static int CountWhereAllBitsSet(Vector2 vector) => BitOperations.PopCount(Equals(vector.AsVector128().AsInt32(), Vector128<int>.AllBitsSet).ExtractMostSignificantBits()); 243internal static int CountWhereAllBitsSet(Vector3 vector) => BitOperations.PopCount(Equals(vector.AsVector128().AsInt32(), Vector128<int>.AllBitsSet).ExtractMostSignificantBits()); 250int result = BitOperations.TrailingZeroCount(Equals(vector.AsVector128(), Create(value, value, -1, -1)).ExtractMostSignificantBits()); 259int result = BitOperations.TrailingZeroCount(Equals(vector.AsVector128(), Create(value, value, value, -1)).ExtractMostSignificantBits()); 268int result = BitOperations.TrailingZeroCount(Equals(vector.AsVector128().AsInt32(), Vector128<int>.AllBitsSet).ExtractMostSignificantBits()); 277int result = BitOperations.TrailingZeroCount(Equals(vector.AsVector128().AsInt32(), Vector128<int>.AllBitsSet).ExtractMostSignificantBits()); 284internal static int LastIndexOf(Vector2 vector, float value) => 31 - BitOperations.LeadingZeroCount(Equals(vector.AsVector128(), Create(value, value, -1, -1)).ExtractMostSignificantBits()); 289internal static int LastIndexOf(Vector3 vector, float value) => 31 - BitOperations.LeadingZeroCount(Equals(vector.AsVector128(), Create(value, value, value, -1)).ExtractMostSignificantBits()); 294internal static int LastIndexOfWhereAllBitsSet(Vector2 vector) => 31 - BitOperations.LeadingZeroCount(Equals(vector.AsVector128().AsInt32(), Vector128<int>.AllBitsSet).ExtractMostSignificantBits()); 299internal static int LastIndexOfWhereAllBitsSet(Vector3 vector) => 31 - BitOperations.LeadingZeroCount(Equals(vector.AsVector128().AsInt32(), Vector128<int>.AllBitsSet).ExtractMostSignificantBits());
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector256.cs (3)
786public static int Count<T>(Vector256<T> vector, T value) => BitOperations.PopCount(Equals(vector, Create(value)).ExtractMostSignificantBits()); 1945int result = BitOperations.TrailingZeroCount(Equals(vector, Create(value)).ExtractMostSignificantBits()); 2178public static int LastIndexOf<T>(Vector256<T> vector, T value) => 31 - BitOperations.LeadingZeroCount(Equals(vector, Create(value)).ExtractMostSignificantBits());
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector512.cs (3)
689public static int Count<T>(Vector512<T> vector, T value) => BitOperations.PopCount(Equals(vector, Create(value)).ExtractMostSignificantBits()); 1971int result = BitOperations.TrailingZeroCount(Equals(vector, Create(value)).ExtractMostSignificantBits()); 2204public static int LastIndexOf<T>(Vector512<T> vector, T value) => 63 - BitOperations.LeadingZeroCount(Equals(vector, Create(value)).ExtractMostSignificantBits());
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Vector64.cs (3)
753public static int Count<T>(Vector64<T> vector, T value) => BitOperations.PopCount(Equals(vector, Create(value)).ExtractMostSignificantBits()); 1777int result = BitOperations.TrailingZeroCount(Equals(vector, Create(value)).ExtractMostSignificantBits()); 2019public static int LastIndexOf<T>(Vector64<T> vector, T value) => 31 - BitOperations.LeadingZeroCount(Equals(vector, Create(value)).ExtractMostSignificantBits());
src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\X86\X86Base.cs (4)
41/// <para>Its functionality is exposed in the public <see cref="Numerics.BitOperations" /> class.</para> 52/// <para>Its functionality is exposed in the public <see cref="Numerics.BitOperations" /> class.</para> 78/// <para>Its functionality is exposed in the public <see cref="Numerics.BitOperations" /> class.</para> 89/// <para>Its functionality is exposed in the public <see cref="Numerics.BitOperations" /> class.</para>
src\libraries\System.Private.CoreLib\src\System\SByte.cs (5)
288public static sbyte LeadingZeroCount(sbyte value) => (sbyte)(BitOperations.LeadingZeroCount((byte)value) - 24); 291public static sbyte PopCount(sbyte value) => (sbyte)BitOperations.PopCount((byte)value); 300public static sbyte TrailingZeroCount(sbyte value) => (sbyte)(BitOperations.TrailingZeroCount(value << 24) - 24); 462public static bool IsPow2(sbyte value) => BitOperations.IsPow2(value); 471return (sbyte)BitOperations.Log2((byte)value);
src\libraries\System.Private.CoreLib\src\System\SearchValues\IndexOfAnyAsciiSearcher.cs (8)
1256int offsetInVector = 31 - BitOperations.LeadingZeroCount(mask); 1265int offsetInVector = 31 - BitOperations.LeadingZeroCount(mask); 1287int offsetInVector = 31 - BitOperations.LeadingZeroCount(mask); 1303int offsetInVector = 31 - BitOperations.LeadingZeroCount(mask); 1471int offsetInVector = BitOperations.TrailingZeroCount(mask); 1486int offsetInVector = BitOperations.TrailingZeroCount(mask); 1494int offsetInVector = BitOperations.TrailingZeroCount(mask); 1515int offsetInVector = BitOperations.TrailingZeroCount(mask);
src\libraries\System.Private.CoreLib\src\System\SearchValues\ProbabilisticMap.cs (16)
785index = BitOperations.TrailingZeroCount(mask); 792mask = BitOperations.ResetLowestSetBit(mask); 806index = BitOperations.TrailingZeroCount(mask); 820mask = BitOperations.ResetLowestSetBit(mask); 834index = BitOperations.TrailingZeroCount(mask); 841mask = BitOperations.ResetLowestSetBit(mask); 855index = BitOperations.TrailingZeroCount(mask); 869mask = BitOperations.ResetLowestSetBit(mask); 883index = 31 - BitOperations.LeadingZeroCount(mask); 891mask = BitOperations.FlipBit(mask, index); 905index = 31 - BitOperations.LeadingZeroCount(mask); 908mask = BitOperations.FlipBit(mask, index); 934index = 63 - BitOperations.LeadingZeroCount(mask); 942mask = BitOperations.FlipBit(mask, index); 956index = 63 - BitOperations.LeadingZeroCount(mask); 959mask = BitOperations.FlipBit(mask, index);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\AsciiStringSearchValuesTeddyBase.cs (12)
543int matchOffset = BitOperations.TrailingZeroCount(resultMask); 558int candidateOffset = BitOperations.TrailingZeroCount(candidateMask); 570candidateMask = BitOperations.ResetLowestSetBit(candidateMask); 574resultMask = BitOperations.ResetLowestSetBit(resultMask); 591int matchOffset = BitOperations.TrailingZeroCount(resultMask); 603int candidateOffset = BitOperations.TrailingZeroCount(candidateMask); 615candidateMask = BitOperations.ResetLowestSetBit(candidateMask); 619resultMask = BitOperations.ResetLowestSetBit(resultMask); 636int matchOffset = BitOperations.TrailingZeroCount(resultMask); 648int candidateOffset = BitOperations.TrailingZeroCount(candidateMask); 660candidateMask = BitOperations.ResetLowestSetBit(candidateMask); 664resultMask = BitOperations.ResetLowestSetBit(resultMask);
src\libraries\System.Private.CoreLib\src\System\SearchValues\Strings\SingleStringSearchValuesThreeChars.cs (6)
333int bitPos = BitOperations.TrailingZeroCount(mask); 346mask = BitOperations.ResetLowestSetBit(BitOperations.ResetLowestSetBit(mask)); 361int bitPos = BitOperations.TrailingZeroCount(mask); 374mask = BitOperations.ResetLowestSetBit(BitOperations.ResetLowestSetBit(mask));
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Byte.cs (26)
113int bitPos = BitOperations.TrailingZeroCount(mask); 121mask = BitOperations.ResetLowestSetBit(mask); // Clear the lowest set bit 174int bitPos = BitOperations.TrailingZeroCount(mask); 182mask = BitOperations.ResetLowestSetBit(mask); // Clear the lowest set bit 235int bitPos = BitOperations.TrailingZeroCount(mask); 244mask = BitOperations.ResetLowestSetBit(mask); 325int highestSetBitIndex = 63 - BitOperations.LeadingZeroCount(mask); 334mask = BitOperations.FlipBit(mask, highestSetBitIndex); 372int highestSetBitIndex = 31 - BitOperations.LeadingZeroCount(mask); 381mask = BitOperations.FlipBit(mask, highestSetBitIndex); 421int highestSetBitIndex = 31 - BitOperations.LeadingZeroCount(mask); 430mask = BitOperations.FlipBit(mask, highestSetBitIndex); 542return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 564return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 584return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 603return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 622return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 655return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 676return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 695return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 727return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 1011offset += (uint)BitOperations.TrailingZeroCount(differences); 1052offset += (uint)BitOperations.TrailingZeroCount(differences); 1089offset += (uint)BitOperations.TrailingZeroCount(differences); 1246=> BitOperations.TrailingZeroCount(match) >> 3; 1250=> BitOperations.Log2(match) >> 3;
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Char.cs (18)
117int bitPos = BitOperations.TrailingZeroCount(mask); 194mask = BitOperations.ResetLowestSetBit(BitOperations.ResetLowestSetBit(mask)); 256mask = BitOperations.ResetLowestSetBit(BitOperations.ResetLowestSetBit(mask)); 341int bitPos = 62 - BitOperations.LeadingZeroCount(mask); 391int bitPos = 30 - BitOperations.LeadingZeroCount(mask); 441int bitPos = 30 - BitOperations.LeadingZeroCount(mask); 610return (int)(offset + ((uint)BitOperations.TrailingZeroCount(matches) / sizeof(char))); 637return (int)(offset + ((uint)BitOperations.TrailingZeroCount(matches) / sizeof(char))); 668return (int)(offset + (uint)BitOperations.TrailingZeroCount(matches)); 691return (int)(offset + ((uint)BitOperations.TrailingZeroCount(matches) / sizeof(char))); 714return (int)(offset + ((uint)BitOperations.TrailingZeroCount(matches) / sizeof(char))); 754return (int)(offset + ((uint)BitOperations.TrailingZeroCount(matches) / sizeof(char))); 779return (int)(offset + ((uint)BitOperations.TrailingZeroCount(matches) / sizeof(char))); 802return (int)(offset + ((uint)BitOperations.TrailingZeroCount(matches) / sizeof(char))); 841return (int)(offset + ((uint)BitOperations.TrailingZeroCount(matches) / sizeof(char))); 866=> BitOperations.TrailingZeroCount(match) >> 4;
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.Packed.cs (6)
1233int index = BitOperations.TrailingZeroCount(notEqualsElements); 1242int index = BitOperations.TrailingZeroCount(notEqualsElements); 1251int index = BitOperations.TrailingZeroCount(notEqualsElements); 1259int offsetInVector = BitOperations.TrailingZeroCount(notEqualsElements); 1274int offsetInVector = BitOperations.TrailingZeroCount(notEqualsElements); 1289int offsetInVector = BitOperations.TrailingZeroCount(notEqualsElements);
src\libraries\System.Private.CoreLib\src\System\SpanHelpers.T.cs (13)
26if (!BitOperations.IsPow2(sizeof(T))) { goto CannotVectorize; } 3329int index = BitOperations.TrailingZeroCount(notEqualsElements); 3337int index = BitOperations.TrailingZeroCount(notEqualsElements); 3345int index = BitOperations.TrailingZeroCount(notEqualsElements); 3353int index = 31 - BitOperations.LeadingZeroCount(notEqualsElements); // 31 = 32 (bits in Int32) - 1 (indexing from zero) 3361int index = 31 - BitOperations.LeadingZeroCount(notEqualsElements); // 31 = 32 (bits in Int32) - 1 (indexing from zero) 3369int index = 63 - BitOperations.LeadingZeroCount(notEqualsElements); // 31 = 32 (bits in Int32) - 1 (indexing from zero) 3791count += BitOperations.PopCount(Vector512.Equals(Vector512.LoadUnsafe(ref current), targetVector).ExtractMostSignificantBits()); 3798count += BitOperations.PopCount(mask); 3806count += BitOperations.PopCount(Vector256.Equals(Vector256.LoadUnsafe(ref current), targetVector).ExtractMostSignificantBits()); 3813count += BitOperations.PopCount(mask); 3821count += BitOperations.PopCount(Vector128.Equals(Vector128.LoadUnsafe(ref current), targetVector).ExtractMostSignificantBits()); 3828count += BitOperations.PopCount(mask);
src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (21)
846hash1 = (BitOperations.RotateLeft(hash1, 5) + hash1) ^ ptr[0]; 847hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ ptr[1]; 853hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ ptr[0]; 877hash1 = BitOperations.RotateLeft(hash1, 5) + hash1 ^ Unsafe.ReadUnaligned<uint>(ptr); 878hash2 = BitOperations.RotateLeft(hash2, 5) + hash2 ^ Unsafe.ReadUnaligned<uint>(ptr + 1); 885hash1 = BitOperations.RotateLeft(hash1, 5) + hash1 ^ Unsafe.ReadUnaligned<uint>(ptr); 892hash2 = BitOperations.RotateLeft(hash2, 5) + hash2 ^ p1; 896hash2 = BitOperations.RotateLeft(hash2, 5) + hash2 ^ Unsafe.ReadUnaligned<uint>(ptr); 906hash2 = BitOperations.RotateLeft(hash2, 5) + hash2 ^ p0; 946hash1 = (BitOperations.RotateLeft(hash1, 5) + hash1) ^ (p0 | NormalizeToLowercase); 947hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (p1 | NormalizeToLowercase); 959hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (p0 | NormalizeToLowercase); 995hash1 = (BitOperations.RotateLeft(hash1, 5) + hash1) ^ (p0 | NormalizeToLowercase); 996hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (p1 | NormalizeToLowercase); 1015hash1 = (BitOperations.RotateLeft(hash1, 5) + hash1) ^ (p0 | NormalizeToLowercase); 1016hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (p1 | NormalizeToLowercase); 1026hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (p0 | NormalizeToLowercase); 1041hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (p0 | NormalizeToLowercase); 1078hash1 = (BitOperations.RotateLeft(hash1, 5) + hash1) ^ (ptr[0] | NormalizeToLowercase); 1079hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (ptr[1] | NormalizeToLowercase); 1085hash2 = (BitOperations.RotateLeft(hash2, 5) + hash2) ^ (ptr[0] | NormalizeToLowercase);
src\libraries\System.Private.CoreLib\src\System\String.Manipulation.cs (6)
2063uint bitPos = (uint)BitOperations.TrailingZeroCount(mask) / sizeof(char); 2065mask = BitOperations.ResetLowestSetBit(mask); 2092uint bitPos = (uint)BitOperations.TrailingZeroCount(mask) / sizeof(char); 2094mask = BitOperations.ResetLowestSetBit(mask); 2121uint bitPos = (uint)BitOperations.TrailingZeroCount(mask) / sizeof(char); 2123mask = BitOperations.ResetLowestSetBit(mask);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Utility.cs (7)
82int index = BitOperations.TrailingZeroCount(mask) >> 2; 598pBuffer += (uint)BitOperations.TrailingZeroCount(currentSseMask); 643pBuffer += (nuint)(BitOperations.TrailingZeroCount(candidateUInt64) >> 3); 1140pBuffer = (char*)((byte*)pBuffer + (uint)BitOperations.TrailingZeroCount(currentMask) - 1); 1153pBuffer += BitOperations.TrailingZeroCount(asciiCompareMask) >> 3; 1201pBuffer = (char*)((byte*)pBuffer + ((nuint)(BitOperations.TrailingZeroCount(candidateUInt64) >> 3) & ~(nuint)1)); 2179asciiData = BitOperations.RotateLeft(asciiData, 8);
src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Utility.Helpers.cs (4)
53return (uint)BitOperations.TrailingZeroCount(value & UInt32HighBitsOnlyMask) >> 3; 69value = BitOperations.RotateLeft(value, 1); 74value = BitOperations.RotateLeft(value, 8); 79value = BitOperations.RotateLeft(value, 8);
src\libraries\System.Private.CoreLib\src\System\Text\Latin1Utility.cs (1)
426pBuffer = (char*)((byte*)pBuffer + (uint)BitOperations.TrailingZeroCount(currentMask) - 1);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf16Utility.Validation.cs (2)
129nuint popcnt = (uint)BitOperations.PopCount(mask); // on x64, perform zero-extension for free 225nuint surrogatePairsCountNuint = (uint)BitOperations.PopCount(highSurrogatesMask);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Helpers.cs (1)
118tempA = BitOperations.RotateLeft(tempA, 16); // = [ 00xxxxxx 00000000 00000000 00000uuu ]
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Transcoding.cs (1)
603toCheck = BitOperations.RotateRight(toCheck, 8);
src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Validation.cs (3)
138trailingZeroCount = (nuint)BitOperations.TrailingZeroCount(mask) >> 2; 156trailingZeroCount = (nuint)BitOperations.TrailingZeroCount(mask); 608thisDWord = BitOperations.RotateRight(thisDWord, 8);
src\libraries\System.Private.CoreLib\src\System\Threading\ThreadLocal.cs (1)
559uint newSize = BitOperations.RoundUpToPowerOf2((uint)minSize);
src\libraries\System.Private.CoreLib\src\System\UInt128.cs (3)
795return 64 + BitOperations.LeadingZeroCount(value._lower); 797return BitOperations.LeadingZeroCount(value._upper); 1181int shift = BitOperations.LeadingZeroCount(divHi);
src\libraries\System.Private.CoreLib\src\System\UInt16.cs (5)
279public static ushort LeadingZeroCount(ushort value) => (ushort)(BitOperations.LeadingZeroCount(value) - 16); 282public static ushort PopCount(ushort value) => (ushort)BitOperations.PopCount(value); 291public static ushort TrailingZeroCount(ushort value) => (ushort)(BitOperations.TrailingZeroCount(value << 16) - 16); 431public static bool IsPow2(ushort value) => BitOperations.IsPow2((uint)value); 434public static ushort Log2(ushort value) => (ushort)BitOperations.Log2(value);
src\libraries\System.Private.CoreLib\src\System\UInt32.cs (8)
296public static uint LeadingZeroCount(uint value) => (uint)BitOperations.LeadingZeroCount(value); 300public static uint PopCount(uint value) => (uint)BitOperations.PopCount(value); 304public static uint RotateLeft(uint value, int rotateAmount) => BitOperations.RotateLeft(value, rotateAmount); 308public static uint RotateRight(uint value, int rotateAmount) => BitOperations.RotateRight(value, rotateAmount); 312public static uint TrailingZeroCount(uint value) => (uint)BitOperations.TrailingZeroCount(value); 430int IBinaryInteger<uint>.GetShortestBitLength() => (sizeof(uint) * 8) - BitOperations.LeadingZeroCount(m_value); 469public static bool IsPow2(uint value) => BitOperations.IsPow2(value); 473public static uint Log2(uint value) => (uint)BitOperations.Log2(value);
src\libraries\System.Private.CoreLib\src\System\UInt64.cs (8)
295public static ulong LeadingZeroCount(ulong value) => (ulong)BitOperations.LeadingZeroCount(value); 299public static ulong PopCount(ulong value) => (ulong)BitOperations.PopCount(value); 303public static ulong RotateLeft(ulong value, int rotateAmount) => BitOperations.RotateLeft(value, rotateAmount); 307public static ulong RotateRight(ulong value, int rotateAmount) => BitOperations.RotateRight(value, rotateAmount); 311public static ulong TrailingZeroCount(ulong value) => (ulong)BitOperations.TrailingZeroCount(value); 429int IBinaryInteger<ulong>.GetShortestBitLength() => (sizeof(ulong) * 8) - BitOperations.LeadingZeroCount(m_value); 468public static bool IsPow2(ulong value) => BitOperations.IsPow2(value); 472public static ulong Log2(ulong value) => (ulong)BitOperations.Log2(value);
src\libraries\System.Private.CoreLib\src\System\UIntPtr.cs (8)
299public static nuint LeadingZeroCount(nuint value) => (nuint)BitOperations.LeadingZeroCount(value); 303public static nuint PopCount(nuint value) => (nuint)BitOperations.PopCount(value); 307public static nuint RotateLeft(nuint value, int rotateAmount) => BitOperations.RotateLeft(value, rotateAmount); 311public static nuint RotateRight(nuint value, int rotateAmount) => BitOperations.RotateRight(value, rotateAmount); 315public static nuint TrailingZeroCount(nuint value) => (nuint)BitOperations.TrailingZeroCount(value); 433int IBinaryInteger<nuint>.GetShortestBitLength() => (sizeof(nuint_t) * 8) - BitOperations.LeadingZeroCount(_value); 481public static bool IsPow2(nuint value) => BitOperations.IsPow2(value); 485public static nuint Log2(nuint value) => (nuint)BitOperations.Log2(value);
src\System\Runtime\CompilerServices\VirtualDispatchHelpers.cs (2)
25_hashCode = (int) ((uint)objectMethodTable + (BitOperations.RotateLeft((uint)classHandle, 5)) + (BitOperations.RotateRight((uint)methodHandle, 5)));
System.Private.Xml (11)
System\Xml\Schema\XsdDateTime.cs (4)
170Debug.Assert(BitOperations.IsPow2((uint)kinds), "One and only one DateTime type code can be set."); 173DateTimeTypeCode code = (DateTimeTypeCode)BitOperations.TrailingZeroCount((uint)kinds); 214Debug.Assert(BitOperations.IsPow2((uint)kinds), "Only one DateTime type code can be set."); 219DateTimeTypeCode code = (DateTimeTypeCode)BitOperations.TrailingZeroCount((uint)kinds);
System\Xml\Xsl\IlGen\XmlIlVisitor.cs (1)
3268if (!BitOperations.IsPow2((uint)kinds))
System\Xml\Xsl\XmlQueryTypeFactory.cs (3)
706if (BitOperations.IsPow2(kinds)) 708return ItemType.Create(s_nodeKindToTypeCode[BitOperations.TrailingZeroCount(kinds) + 1], false); 714members.Add(ItemType.Create(s_nodeKindToTypeCode[BitOperations.TrailingZeroCount(kinds) + 1], false));
System\Xml\Xsl\Xslt\CompilerScopeManager.cs (2)
149Debug.Assert(flag == (flag & ScopeFlags.ExclusiveFlags) && BitOperations.IsPow2((uint)flag), "One exclusive flag"); 168Debug.Assert(flag == (flag & ScopeFlags.InheritedFlags) && BitOperations.IsPow2((uint)flag), "one inherited flag");
System\Xml\Xsl\Xslt\MatcherBuilder.cs (1)
183if (!BitOperations.IsPow2((uint)nodeKinds))
System.Private.Xml.Linq (1)
System\Xml\Linq\XHashtable.cs (1)
147Debug.Assert(BitOperations.IsPow2(capacity), "capacity must be a power of 2");
System.Reflection.Metadata (2)
System\Reflection\Internal\Utilities\BitArithmetic.cs (2)
21return BitOperations.PopCount(v); 35return BitOperations.PopCount(v);
System.Runtime (1)
artifacts\obj\System.Runtime\Debug\net10.0\System.Runtime.Forwards.cs (1)
371[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Numerics.BitOperations))]
System.Runtime.Extensions (1)
System.Runtime.Extensions.cs (1)
53[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.Numerics.BitOperations))]
System.Runtime.Numerics (19)
src\libraries\System.Private.CoreLib\src\System\Buffers\Text\FormattingHelpers.CountDigits.cs (1)
112return (BitOperations.Log2(value) >> 2) + 1;
System\Number.BigInteger.cs (3)
1084maxIndex = BitOperations.Log2(scale1E9); 1131int fi = BitOperations.TrailingZeroCount(trailingPartialCount); 1140if ((BitOperations.PopCount((uint)trailingPartialCount) & 1) != 0)
System\Numerics\BigInteger.cs (9)
643return BitOperations.IsPow2(_sign); 650return BitOperations.IsPow2(_bits[iu]) && !_bits.AsSpan(0, iu).ContainsAnyExcept(0u); 858int c = BitOperations.LeadingZeroCount((uint)h); 1879int z = BitOperations.LeadingZeroCount((uint)h); 3103long bitLength = bitsArrayLength * 32L - BitOperations.LeadingZeroCount(highValue); 3620return (sizeof(int) * 8) - BitOperations.LeadingZeroCount((uint)(value)); 3624return (sizeof(int) * 8) + 1 - BitOperations.LeadingZeroCount((uint)(~value)); 3632result += (sizeof(uint) * 8) - BitOperations.LeadingZeroCount(bits[^1]); 3651result += (sizeof(uint) * 8) + 1 - BitOperations.LeadingZeroCount(~part);
System\Numerics\BigIntegerCalculator.DivRem.cs (4)
227int shift = BitOperations.LeadingZeroCount(divHi); 373int m = (int)BitOperations.RoundUpToPowerOf2((uint)right.Length / (uint)DivideBurnikelZieglerThreshold + 1); 380int sigmaSmall = BitOperations.LeadingZeroCount(right[^1]); 393if (BitOperations.LeadingZeroCount(left[^1]) <= sigmaSmall)
System\Numerics\BigIntegerCalculator.GcdInv.cs (1)
267int z = BitOperations.LeadingZeroCount((uint)xh);
System\Numerics\NumericsHelpers.cs (1)
53int cbitShift = BitOperations.LeadingZeroCount(man) - 11;
System.Security.Cryptography (2)
System\Security\Cryptography\RandomNumberGenerator.cs (2)
362if (BitOperations.IsPow2(choices.Length)) 394int mask = (int)BitOperations.RoundUpToPowerOf2((uint)choices.Length) - 1;
System.Text.Encodings.Web (2)
System\Text\Encodings\Web\DefaultHtmlEncoder.cs (2)
106int idxOfSemicolon = (int)((uint)BitOperations.Log2(scalarValue) / 4) + 4; 181int idxOfSemicolon = (int)((uint)BitOperations.Log2(scalarValue) / 4) + 4;
System.Text.RegularExpressions (2)
System\Text\RegularExpressions\RegexCharClass.cs (1)
1255return BitOperations.IsPow2(mask);
System\Text\RegularExpressions\Symbolic\SymbolicRegexMatcher.cs (1)
183_mintermsLog = BitOperations.Log2((uint)_minterms.Length) + 1;
System.Windows.Forms.Tests (2)
System\Windows\Forms\DragDropHelperTests.cs (2)
123bool isDragImageNull = BitOperations.LeadingZeroCount((uint)(nint)pDragImage->hbmpDragImage).Equals(32); 150bool isDragImageNull = BitOperations.LeadingZeroCount((uint)(nint)pDragImage->hbmpDragImage).Equals(32);
Test.Utilities (2)
src\Dependencies\Collections\Internal\ArraySortHelper.cs (1)
1269return BitOperations.Log2(value);
src\Dependencies\Collections\Internal\SegmentedArrayHelper.cs (1)
175return System.Numerics.BitOperations.Log2((uint)((Threshold / elementSize) - (2 * Unsafe.SizeOf<object>() + 8)));