1198 references to BitConverter
aspire (1)
Telemetry\MachineInformationProviderBase.cs (1)
83return BitConverter.ToString(hashInput).Replace("-", string.Empty).ToLowerInvariant();
csc (4)
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (4)
129var length = BitConverter.ToInt32(lengthBuffer, 0); 186await outStream.WriteAsync(BitConverter.GetBytes(length), 0, 4, 302await outStream.WriteAsync(BitConverter.GetBytes(length), 325var length = BitConverter.ToUInt32(lengthBuffer, 0);
dotnet (20)
Commands\Test\MTP\IPC\NamedPipeServer.cs (4)
109remainingBytesToReadOfWholeMessage = BitConverter.ToInt32(remainingBytesToProcess.Span); 145int serializerId = BitConverter.ToInt32(_messageBuffer.GetBuffer(), 0); 175if (!BitConverter.TryWriteBytes(bytes, sizeOfTheWholeMessage)) 184if (!BitConverter.TryWriteBytes(bytes, responseNamedPipeSerializer.Id))
Commands\Test\MTP\IPC\Serializers\BaseSerializer.cs (12)
14int stringLen = BitConverter.ToInt32(len); 48BitConverter.TryWriteBytes(len, stringutf8TotalBytes); 79if (BitConverter.TryWriteBytes(len, stringutf8TotalBytes)) 91if (BitConverter.TryWriteBytes(len, sizeInBytes)) 100BitConverter.TryWriteBytes(bytes, value); 108BitConverter.TryWriteBytes(bytes, value); 116BitConverter.TryWriteBytes(bytes, value); 124BitConverter.TryWriteBytes(bytes, value); 133return BitConverter.ToInt32(bytes); 140return BitConverter.ToInt64(bytes); 147return BitConverter.ToUInt16(bytes); 154return BitConverter.ToBoolean(bytes);
src\sdk\artifacts\.packages\microsoft.codeanalysis.buildclient\5.10.0-1.26377.101\contentFiles\cs\net11.0\BuildProtocol.cs (4)
129var length = BitConverter.ToInt32(lengthBuffer, 0); 186await outStream.WriteAsync(BitConverter.GetBytes(length), 0, 4, 302await outStream.WriteAsync(BitConverter.GetBytes(length), 325var length = BitConverter.ToUInt32(lengthBuffer, 0);
dotnet-sourcelink (1)
dotnet-svcutil-lib (8)
FrameworkFork\Microsoft.Xml\Xml\XmlEncoding.cs (2)
65if (_bigEndian == BitConverter.IsLittleEndian) 128if (_bigEndian == BitConverter.IsLittleEndian)
FrameworkFork\System.Runtime.Serialization\System\Xml\XmlBinaryReader.cs (6)
1271if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int16TextWithEndElement) && BitConverter.IsLittleEndian) 1278if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int16TextWithEndElement) && BitConverter.IsLittleEndian) 1303if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int32TextWithEndElement) && BitConverter.IsLittleEndian) 1310if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int32TextWithEndElement) && BitConverter.IsLittleEndian) 1335if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int64TextWithEndElement) && BitConverter.IsLittleEndian) 1342if (IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int64TextWithEndElement) && BitConverter.IsLittleEndian)
GenerateDocumentationAndConfigFiles (17)
src\roslyn\src\Compilers\Core\Portable\Collections\Boxes.cs (1)
89return BitConverter.DoubleToInt64Bits(d) == 0 ? BoxedDoubleZero : d;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
223if (BitConverter.IsLittleEndian)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
161static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 492if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 500else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 528if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 559else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 633if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 645else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 727if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 738else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 793BitConverter.IsLittleEndian ? 799BitConverter.IsLittleEndian ? 806if (!BitConverter.IsLittleEndian)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RoslynHashCode.cs (1)
84return BitConverter.ToUInt32(array, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
45Debug.Assert(BitConverter.IsLittleEndian);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
92Debug.Assert(BitConverter.IsLittleEndian);
ILAssembler (17)
GrammarVisitor.cs (17)
2508SerializationTypeCode.Char => valueBytes.Length >= 2 ? BitConverter.ToChar(valueBytes) : '\0', 2511SerializationTypeCode.Int16 => valueBytes.Length >= 2 ? BitConverter.ToInt16(valueBytes) : (short)0, 2512SerializationTypeCode.UInt16 => valueBytes.Length >= 2 ? BitConverter.ToUInt16(valueBytes) : (ushort)0, 2513SerializationTypeCode.Int32 => valueBytes.Length >= 4 ? BitConverter.ToInt32(valueBytes) : 0, 2514SerializationTypeCode.UInt32 => valueBytes.Length >= 4 ? BitConverter.ToUInt32(valueBytes) : 0u, 2515SerializationTypeCode.Int64 => valueBytes.Length >= 8 ? BitConverter.ToInt64(valueBytes) : 0L, 2516SerializationTypeCode.UInt64 => valueBytes.Length >= 8 ? BitConverter.ToUInt64(valueBytes) : 0uL, 2517SerializationTypeCode.Single => valueBytes.Length >= 4 ? BitConverter.ToSingle(valueBytes) : 0f, 2518SerializationTypeCode.Double => valueBytes.Length >= 8 ? BitConverter.ToDouble(valueBytes) : 0d, 2666builder.WriteSingle(BitConverter.Int32BitsToSingle(value)); 2679builder.WriteDouble(BitConverter.Int64BitsToDouble(value)); 2754return new(BitConverter.Int32BitsToSingle(value)); 2759return new(BitConverter.Int64BitsToDouble(value)); 3046value = BitConverter.Int64BitsToDouble(intValue); 3053value = BitConverter.ToDouble(bytes, 0); 3057value = BitConverter.ToSingle(bytes, 0); 3103if (!BitConverter.IsLittleEndian)
ILCompiler.Compiler (13)
Compiler\ExpectedIsaFeaturesRootProvider.cs (1)
27byte[] bytes = BitConverter.GetBytes(isaFlags);
Compiler\ObjectWriter\Dwarf\DwarfFde.cs (2)
57short dwarfReg = BitConverter.ToInt16(blobData, offset); 59int cfiOffset = BitConverter.ToInt32(blobData, offset);
Compiler\TypePreinit.cs (10)
2426public override short AsInt16() => BitConverter.ToInt16(AsExactByteCount(2), 0); 2427public override int AsInt32() => BitConverter.ToInt32(AsExactByteCount(4), 0); 2428public override long AsInt64() => BitConverter.ToInt64(AsExactByteCount(8), 0); 2429public override float AsSingle() => BitConverter.ToSingle(AsExactByteCount(4), 0); 2430public override double AsDouble() => BitConverter.ToDouble(AsExactByteCount(8), 0); 2432public static ValueTypeValue FromInt16(short value) => new ValueTypeValue(BitConverter.GetBytes(value)); 2433public static ValueTypeValue FromInt32(int value) => new ValueTypeValue(BitConverter.GetBytes(value)); 2434public static ValueTypeValue FromInt64(long value) => new ValueTypeValue(BitConverter.GetBytes(value)); 2435public static ValueTypeValue FromSingle(float value) => new ValueTypeValue(BitConverter.GetBytes(value)); 2436public static ValueTypeValue FromDouble(double value) => new ValueTypeValue(BitConverter.GetBytes(value));
ILCompiler.Diagnostics (4)
PerfMapWriter.cs (4)
87if (!BitConverter.TryWriteBytes(buffer.AsSpan(0, sizeof(uint)), (uint)targetTokens.OperatingSystem) 88|| !BitConverter.TryWriteBytes(buffer.AsSpan(4, sizeof(uint)), (uint)targetTokens.Architecture) 89|| !BitConverter.TryWriteBytes(buffer.AsSpan(8, sizeof(uint)), (uint)targetTokens.Abi)) 94if (!BitConverter.IsLittleEndian)
ILCompiler.MetadataTransform (4)
Internal\Metadata\NativeFormat\Writer\NativeMetadataWriter.cs (4)
1004return BitConverter.SingleToInt32Bits(x) == BitConverter.SingleToInt32Bits(y); 1009return BitConverter.DoubleToInt64Bits(x) == BitConverter.DoubleToInt64Bits(y);
ILCompiler.ReadyToRun (6)
JitInterface\CorInfoImpl.ReadyToRun.cs (6)
1577Array.Copy(BitConverter.GetBytes((uint)flags), 0, ehInfoData, clauseOffset + (int)EHInfoFields.Flags * sizeof(uint), sizeof(uint)); 1578Array.Copy(BitConverter.GetBytes((uint)clause.TryOffset), 0, ehInfoData, clauseOffset + (int)EHInfoFields.TryOffset * sizeof(uint), sizeof(uint)); 1580Array.Copy(BitConverter.GetBytes((uint)(clause.TryLength)), 0, ehInfoData, clauseOffset + (int)EHInfoFields.TryEnd * sizeof(uint), sizeof(uint)); 1581Array.Copy(BitConverter.GetBytes((uint)clause.HandlerOffset), 0, ehInfoData, clauseOffset + (int)EHInfoFields.HandlerOffset * sizeof(uint), sizeof(uint)); 1582Array.Copy(BitConverter.GetBytes((uint)(clause.HandlerLength)), 0, ehInfoData, clauseOffset + (int)EHInfoFields.HandlerEnd * sizeof(uint), sizeof(uint)); 1583Array.Copy(BitConverter.GetBytes(classTokenOrOffset), 0, ehInfoData, clauseOffset + (int)EHInfoFields.ClassTokenOrOffset * sizeof(uint), sizeof(uint));
ILCompiler.RyuJit (2)
JitInterface\CorInfoImpl.RyuJit.cs (2)
141short dwarfReg = BitConverter.ToInt16(blobData, offset); 143int cfiOffset = BitConverter.ToInt32(blobData, offset);
Microsoft.AspNetCore.Antiforgery (1)
Internal\BinaryBlob.cs (1)
76return BitConverter.ToInt32(_data, 0);
Microsoft.AspNetCore.App.CodeFixes (1)
src\aspnetcore\src\Shared\HashCode.cs (1)
75return BitConverter.ToUInt32(array, 0);
Microsoft.AspNetCore.Components.Server (3)
src\aspnetcore\src\submodules\MessagePack-CSharp\src\MessagePack.UnityClient\Assets\Scripts\MessagePack\SequenceReaderExtensions.cs (3)
136if (!BitConverter.IsLittleEndian) 177if (!BitConverter.IsLittleEndian) 218if (!BitConverter.IsLittleEndian)
Microsoft.AspNetCore.Http.RequestDelegateGenerator (1)
src\aspnetcore\src\Shared\HashCode.cs (1)
75return BitConverter.ToUInt32(array, 0);
Microsoft.AspNetCore.Mvc.TagHelpers (2)
Cache\DistributedCacheTagHelperService.cs (2)
168var keyLength = BitConverter.GetBytes(serializedKey.Length); 187var keyLength = BitConverter.ToInt32(keyLengthBuffer, 0);
Microsoft.AspNetCore.OpenApi.SourceGenerators (1)
src\aspnetcore\src\Shared\HashCode.cs (1)
75return BitConverter.ToUInt32(array, 0);
Microsoft.AspNetCore.Razor.Utilities.Shared (13)
Utilities\Hashing\XxHash128.cs (1)
221if (BitConverter.IsLittleEndian)
Utilities\Hashing\XxHashShared.cs (12)
160static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 491if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 499else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 527if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 558else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 632if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 644else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 726if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 737else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 792BitConverter.IsLittleEndian ? 798BitConverter.IsLittleEndian ? 805if (!BitConverter.IsLittleEndian)
Microsoft.AspNetCore.Server.Kestrel.Core (7)
Internal\Http\HttpHeaders.cs (4)
502if (!BitConverter.IsLittleEndian) 516if (!BitConverter.IsLittleEndian) 646if (!BitConverter.IsLittleEndian) 666if (!BitConverter.IsLittleEndian)
Internal\Http\HttpHeaders.Generated.cs (3)
7487if (!BitConverter.IsLittleEndian) 7497if (!BitConverter.IsLittleEndian) 7507if (!BitConverter.IsLittleEndian)
Microsoft.Build.Framework (6)
BackEnd\CommunicationsUtilities.cs (4)
381byte[] bytes = BitConverter.GetBytes(value); 385if (BitConverter.IsLittleEndian) 548if (BitConverter.IsLittleEndian) 553result = HandshakeResult.Success(BitConverter.ToInt32(bytes, 0 /* start index */));
MSBuildNameIgnoreCaseComparer.cs (2)
143if (BitConverter.IsLittleEndian) 163if (BitConverter.IsLittleEndian)
Microsoft.Build.Tasks.CodeAnalysis (4)
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (4)
129var length = BitConverter.ToInt32(lengthBuffer, 0); 186await outStream.WriteAsync(BitConverter.GetBytes(length), 0, 4, 302await outStream.WriteAsync(BitConverter.GetBytes(length), 325var length = BitConverter.ToUInt32(lengthBuffer, 0);
Microsoft.CodeAnalysis (30)
CodeGen\ILBuilderEmit.cs (3)
828int int32 = BitConverter.ToInt32(BitConverter.GetBytes(floatValue), 0); 834long int64 = BitConverter.DoubleToInt64Bits(doubleValue);
Collections\Boxes.cs (1)
89return BitConverter.DoubleToInt64Bits(d) == 0 ? BoxedDoubleZero : d;
ConstantValue.cs (3)
285if (BitConverter.DoubleToInt64Bits(value) == 0) 299if (BitConverter.DoubleToInt64Bits(value) == 0) 313if (BitConverter.DoubleToInt64Bits(value) == 0)
ConstantValueSpecialized.cs (1)
26private static readonly double _s_IEEE_canonical_NaN = BitConverter.Int64BitsToDouble(unchecked((long)0xFFF8000000000000UL));
Emit\EditAndContinue\EncLocalInfo.cs (1)
82(Signature != null) ? BitConverter.ToString(Signature) : "null");
Emit\EditAndContinueMethodDebugInformation.cs (2)
84offset, (start != 0) ? "..." : "", BitConverter.ToString(left), BitConverter.ToString(right), (end != data.Length) ? "..." : ""));
Hashing\XxHash128.cs (1)
223if (BitConverter.IsLittleEndian)
Hashing\XxHashShared.cs (12)
161static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 492if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 500else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 528if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 559else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 633if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 645else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 727if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 738else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 793BitConverter.IsLittleEndian ? 799BitConverter.IsLittleEndian ? 806if (!BitConverter.IsLittleEndian)
RealParser.cs (3)
38d = BitConverter.Int64BitsToDouble((long)result); 265public override ulong Zero => (ulong)BitConverter.DoubleToInt64Bits(0.0d); 266public override ulong Infinity => (ulong)BitConverter.DoubleToInt64Bits(double.PositiveInfinity);
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (1)
50size = BitConverter.ToInt32(bytes, offset + 4);
StrongName\StrongNameKeys.cs (1)
99nameof(CompilationOptions.CryptoPublicKey), BitConverter.ToString(publicKey.ToArray())));
Text\SourceText.cs (1)
651if (!BitConverter.IsLittleEndian)
Microsoft.CodeAnalysis.Analyzers (9)
src\roslyn\src\Compilers\Core\Portable\Collections\Boxes.cs (1)
89return BitConverter.DoubleToInt64Bits(d) == 0 ? BoxedDoubleZero : d;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
223if (BitConverter.IsLittleEndian)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (4)
161static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 793BitConverter.IsLittleEndian ? 799BitConverter.IsLittleEndian ? 806if (!BitConverter.IsLittleEndian)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RoslynHashCode.cs (1)
84return BitConverter.ToUInt32(array, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
45Debug.Assert(BitConverter.IsLittleEndian);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
92Debug.Assert(BitConverter.IsLittleEndian);
Microsoft.CodeAnalysis.AnalyzerUtilities (9)
src\roslyn\src\Compilers\Core\Portable\Collections\Boxes.cs (1)
89return BitConverter.DoubleToInt64Bits(d) == 0 ? BoxedDoubleZero : d;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
223if (BitConverter.IsLittleEndian)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (4)
161static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 793BitConverter.IsLittleEndian ? 799BitConverter.IsLittleEndian ? 806if (!BitConverter.IsLittleEndian)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RoslynHashCode.cs (1)
84return BitConverter.ToUInt32(array, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
45Debug.Assert(BitConverter.IsLittleEndian);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
92Debug.Assert(BitConverter.IsLittleEndian);
Microsoft.CodeAnalysis.CodeStyle (8)
src\roslyn\src\Compilers\Core\Portable\Collections\Boxes.cs (1)
89return BitConverter.DoubleToInt64Bits(d) == 0 ? BoxedDoubleZero : d;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
223if (BitConverter.IsLittleEndian)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (4)
161static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 793BitConverter.IsLittleEndian ? 799BitConverter.IsLittleEndian ? 806if (!BitConverter.IsLittleEndian)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
45Debug.Assert(BitConverter.IsLittleEndian);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
92Debug.Assert(BitConverter.IsLittleEndian);
Microsoft.CodeAnalysis.CSharp (6)
Symbols\Source\SourceNamedTypeSymbol_Extension.cs (4)
972int i2 = BitConverter.ToInt32(BitConverter.GetBytes(f), startIndex: 0); 978long l2 = BitConverter.DoubleToInt64Bits(d); 1152if (!BitConverter.IsLittleEndian)
Utilities\ValueSetFactory.DoubleTC.cs (2)
56return (ulong)BitConverter.DoubleToInt64Bits(d); 61return BitConverter.Int64BitsToDouble((long)l);
Microsoft.CodeAnalysis.Features (2)
PdbSourceDocument\PdbSourceDocumentLoaderService.cs (1)
59var uncompressedSize = BitConverter.ToInt32(embeddedTextBytes, 0);
src\roslyn\src\Dependencies\CodeAnalysis.Debugging\CustomDebugInfoReader.cs (1)
50size = BitConverter.ToInt32(bytes, offset + 4);
Microsoft.CodeAnalysis.NetAnalyzers (3)
Microsoft.NetCore.Analyzers\Performance\UseSpanClearInsteadOfFill.cs (2)
111return BitConverter.DoubleToInt64Bits(f) == 0; 114return BitConverter.DoubleToInt64Bits(d) == 0;
src\sdk\src\Microsoft.CodeAnalysis.NetAnalyzers\src\Utilities\Compiler\RoslynHashCode.cs (1)
83return BitConverter.ToUInt32(array, 0);
Microsoft.CodeAnalysis.Rebuild (1)
CompilationOptionsReader.cs (1)
214int uncompressedSize = BitConverter.ToInt32(bytes, 0);
Microsoft.CodeAnalysis.ResxSourceGenerator (9)
src\roslyn\src\Compilers\Core\Portable\Collections\Boxes.cs (1)
89return BitConverter.DoubleToInt64Bits(d) == 0 ? BoxedDoubleZero : d;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
223if (BitConverter.IsLittleEndian)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (4)
161static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 793BitConverter.IsLittleEndian ? 799BitConverter.IsLittleEndian ? 806if (!BitConverter.IsLittleEndian)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RoslynHashCode.cs (1)
84return BitConverter.ToUInt32(array, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
45Debug.Assert(BitConverter.IsLittleEndian);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
92Debug.Assert(BitConverter.IsLittleEndian);
Microsoft.CodeAnalysis.Workspaces (21)
FindSymbols\FindLiterals\FindLiteralsSearchEngine.cs (2)
53_longValue = BitConverter.DoubleToInt64Bits(d); 57_longValue = BitConverter.DoubleToInt64Bits(f);
FindSymbols\SyntaxTree\SyntaxTreeIndex_Create.cs (2)
169longLiterals.Add(BitConverter.DoubleToInt64Bits(d)); 172longLiterals.Add(BitConverter.DoubleToInt64Bits(f));
Shared\Extensions\TelemetryExtensions.cs (1)
28var suffixBytes = BitConverter.GetBytes(suffix).Concat(new byte[4]).ToArray();
src\roslyn\src\Compilers\Core\Portable\Collections\Boxes.cs (1)
89return BitConverter.DoubleToInt64Bits(d) == 0 ? BoxedDoubleZero : d;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
223if (BitConverter.IsLittleEndian)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (12)
161static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 492if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 500else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 528if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 559else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 633if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 645else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 727if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 738else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 793BitConverter.IsLittleEndian ? 799BitConverter.IsLittleEndian ? 806if (!BitConverter.IsLittleEndian)
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
45Debug.Assert(BitConverter.IsLittleEndian);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
92Debug.Assert(BitConverter.IsLittleEndian);
Microsoft.Data.Analysis.Tests (1)
DataFrameTests.Utils.cs (1)
66byte[] offsetValueBytes = BitConverter.GetBytes(offsetValue);
Microsoft.Deployment.DotNet.Releases (1)
Utils.cs (1)
106return BitConverter.ToString(checksum).Replace("-", "").ToLowerInvariant();
Microsoft.Diagnostics.DataContractReader.Contracts (2)
Contracts\GCInfo\X86\CallPattern.cs (1)
17byte[] fld = BitConverter.GetBytes(val);
PrintfStressMessageFormatter.cs (1)
167double value = BitConverter.UInt64BitsToDouble(valueAsBits.Value);
Microsoft.Diagnostics.DataContractReader.Legacy (2)
Dbi\DacDbiImpl.cs (2)
6321if (BitConverter.IsLittleEndian) 6334if (BitConverter.IsLittleEndian)
Microsoft.Diagnostics.NETCore.Client (5)
DiagnosticsClient\EventPipeSession.cs (2)
181byte[] payload = BitConverter.GetBytes(_sessionId); 182if (!BitConverter.IsLittleEndian)
DiagnosticsIpc\IpcAdvertise.cs (3)
94byte[] processIdBuffer = BitConverter.GetBytes(processId); 95if (!BitConverter.IsLittleEndian) 103Array.Copy(BitConverter.GetBytes(future), 0, buffer, index, sizeof(short));
Microsoft.DotNet.Arcade.Sdk (2)
src\GenerateChecksums.cs (1)
47string checksum = BitConverter.ToString(hash).Replace("-", string.Empty);
src\GenerateSourcePackageSourceLinkTargetsFile.cs (1)
110hash = BitConverter.ToString(hashAlg.ComputeHash(Encoding.UTF8.GetBytes(packageId)), 0, 20).Replace("-", "");
Microsoft.DotNet.Build.Tasks.Installers (1)
src\RpmHeader.cs (1)
57builder.AppendLine($"\t\t{BitConverter.ToString(((ArraySegment<byte>)entry.Value).Array!, ((ArraySegment<byte>)entry.Value).Offset, ((ArraySegment<byte>)entry.Value).Count)}");
Microsoft.DotNet.Build.Tasks.VisualStudio (1)
Vsix\FinalizeInsertionVsixFile.cs (1)
123file["sha256"] = BitConverter.ToString(partHash).Replace("-", "");
Microsoft.DotNet.Build.Tasks.Workloads (12)
Utils.cs (12)
136int timeLow = IPAddress.HostToNetworkOrder(BitConverter.ToInt32(namespaceBytes, 0)); 138short timeMid = IPAddress.HostToNetworkOrder(BitConverter.ToInt16(namespaceBytes, 4)); 140short timeHiVersion = IPAddress.HostToNetworkOrder(BitConverter.ToInt16(namespaceBytes, 6)); 146Buffer.BlockCopy(BitConverter.GetBytes(timeLow), 0, hashBuffer, 0, 4); 147Buffer.BlockCopy(BitConverter.GetBytes(timeMid), 0, hashBuffer, 4, 2); 148Buffer.BlockCopy(BitConverter.GetBytes(timeHiVersion), 0, hashBuffer, 6, 2); 161timeLow = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(hash, 0)); 162Buffer.BlockCopy(BitConverter.GetBytes(timeLow), 0, hash, 0, 4); 165timeMid = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(hash, 4)); 166Buffer.BlockCopy(BitConverter.GetBytes(timeMid), 0, hash, 4, 2); 169timeHiVersion = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(hash, 6)); 173Buffer.BlockCopy(BitConverter.GetBytes(timeHiVersion), 0, hash, 6, 2);
Microsoft.DotNet.StrongName (3)
Signing.cs (2)
72tokenStr = BitConverter.ToString(token).Replace("-", "").ToLowerInvariant(); 224var checksumBytes = BitConverter.GetBytes(checksum);
Utils.cs (1)
95var flagBytes = BitConverter.GetBytes((uint)(peHeaders.CorHeader.Flags | CorFlags.StrongNameSigned));
Microsoft.Extensions.AI.Integration.Tests (1)
ImageGeneratingChatClientIntegrationTests.cs (1)
420BitConverter.GetBytes(++ImageCounter).CopyTo(imageData, _testImageData.Length);
Microsoft.Extensions.Caching.Hybrid.Tests (1)
SerializerTests.cs (1)
300return BitConverter.ToString(value.ToArray());
Microsoft.Extensions.Identity.Core (1)
Rfc6238AuthenticationService.cs (1)
39var res = BitConverter.TryWriteBytes(timestepAsBytes, IPAddress.HostToNetworkOrder((long)timestepNumber));
Microsoft.Extensions.Validation.ValidationsGenerator (1)
src\aspnetcore\src\Shared\HashCode.cs (1)
75return BitConverter.ToUInt32(array, 0);
Microsoft.Maui (1)
Services\Crc64HashAlgorithm.cs (1)
167 protected override byte[] HashFinal() => BitConverter.GetBytes(crc ^ length);
Microsoft.Maui.Controls.SourceGen (1)
src\Core\src\Services\Crc64HashAlgorithm.cs (1)
167 protected override byte[] HashFinal() => BitConverter.GetBytes(crc ^ length);
Microsoft.ML.CpuMath (1)
SseIntrinsics.cs (1)
68Vector128.Create(BitConverter.Int32BitsToSingle(0x7FFFFFFF));
Microsoft.ML.FastTree (8)
Utils\ToByteArrayExtensions.cs (8)
61short a = BitConverter.ToInt16(buffer, position); 83ushort a = BitConverter.ToUInt16(buffer, position); 105int a = BitConverter.ToInt32(buffer, position); 127uint a = BitConverter.ToUInt32(buffer, position); 149long a = BitConverter.ToInt64(buffer, position); 171ulong a = BitConverter.ToUInt64(buffer, position); 193float a = BitConverter.ToSingle(buffer, position); 215double a = BitConverter.ToDouble(buffer, position);
Microsoft.ML.Parquet (2)
ParquetLoader.cs (2)
731ulong lo = BitConverter.ToUInt64(arr, 0); 732ulong hi = BitConverter.ToUInt64(arr, 8);
Microsoft.ML.Tokenizers (5)
Normalizer\SentencePieceNormalizer.cs (2)
581if (!BitConverter.IsLittleEndian) 593if (!BitConverter.IsLittleEndian)
SentencepieceModel.cs (3)
93if (BitConverter.IsLittleEndian) 95value = BitConverter.ToSingle(data, pos); 105value = BitConverter.ToSingle(buffer, 0);
Microsoft.ML.Tokenizers.Tests (6)
SentencePieceTests.cs (6)
889byte[] bytes = BitConverter.GetBytes(value); 890if (!BitConverter.IsLittleEndian) 907byte[] bytes = BitConverter.GetBytes(value); 908if (!BitConverter.IsLittleEndian) 918byte[] bytes = BitConverter.GetBytes(value); 919if (!BitConverter.IsLittleEndian)
Microsoft.ML.Vision (4)
ImageClassificationTrainer.cs (4)
875featuresWriter.Write(BitConverter.GetBytes(examples), 0, sizeof(int)); 876featuresWriter.Write(BitConverter.GetBytes(featureLength), 0, sizeof(int)); 967int trainingExamples = BitConverter.ToInt32(buffer, 0); 969int featureFileRecordSize = sizeof(float) * BitConverter.ToInt32(buffer, 0);
Microsoft.NET.Build.Tasks (3)
CreateAppHost.cs (1)
149throw new BuildErrorException(Strings.AppHostHasBeenModified, AppHostSourcePath, BitConverter.ToString(ex.MissingPattern));
GenerateShims.cs (1)
142throw new BuildErrorException(Strings.AppHostHasBeenModified, resolvedApphostAssetPath, BitConverter.ToString(ex.MissingPattern));
NugetContentAssetPreprocessor.cs (1)
76return BitConverter.ToString(XxHash3.Hash(stream.GetBuffer().AsSpan(0, (int)stream.Length))).Replace("-", "");
Microsoft.NET.HostModel (12)
AppHost\PEUtils.cs (2)
140=> BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value); 143=> BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value);
Bundle\Bundler.cs (1)
387BitConverter.GetBytes(headerOffset),
MachO\FileUtils\EndianConversionExtensions.cs (4)
13return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value; 18return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value; 23return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value; 28return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(value) : value;
src\runtime\src\coreclr\tools\Common\MachO\BinaryFormat\NameBuffer.cs (5)
29if (BitConverter.IsLittleEndian) 31_nameLower = BitConverter.ToUInt64(buffer, 0); 32_nameUpper = BitConverter.ToUInt64(buffer, 8); 36_nameLower = BitConverter.ToUInt64(buffer, 8); 37_nameUpper = BitConverter.ToUInt64(buffer, 0);
Microsoft.NET.Sdk.Razor.Tasks (4)
src\sdk\src\RazorSdk\Tool\ServerProtocol\ServerRequest.cs (2)
129var length = BitConverter.ToInt32(lengthBuffer, 0); 199.WriteAsync(BitConverter.GetBytes(length), 0, 4, cancellationToken)
src\sdk\src\RazorSdk\Tool\ServerProtocol\ServerResponse.cs (2)
69.WriteAsync(BitConverter.GetBytes(length), 0, 4, cancellationToken) 95var length = BitConverter.ToUInt32(lengthBuffer, 0);
Microsoft.NET.StringTools (2)
InternableString.cs (2)
357hash ^= BitConverter.IsLittleEndian ? ((uint)*charPtr << 16) : *charPtr; 374hash = (RotateLeft(hash, 5) + hash) ^ (BitConverter.IsLittleEndian ? *((char*)ptr) : ((uint)*((char*)ptr) << 16));
Microsoft.Private.Windows.Core (2)
Windows\Win32\Graphics\Gdi\ARGB.cs (2)
25Debug.Assert(BitConverter.IsLittleEndian); 35Debug.Assert(BitConverter.IsLittleEndian);
Microsoft.TemplateEngine.Orchestrator.RunnableProjects (3)
CryptoRandom.cs (3)
28return BitConverter.ToInt32(_uint32Buffer, 0) & 0x7FFFFFFF; 59uint rand = BitConverter.ToUInt32(_uint32Buffer, 0); 72uint rand = BitConverter.ToUInt32(_uint32Buffer, 0);
Microsoft.TestPlatform.CoreUtilities (2)
Helpers\DotnetHostHelper.cs (2)
423var magic = BitConverter.ToUInt32(magicBytes, 0); 432var cpuInfo = BitConverter.ToUInt32(cpuInfoBytes, 0);
Microsoft.VisualBasic.Core (11)
Microsoft\VisualBasic\Strings.vb (2)
197If BitConverter.IsLittleEndian Then 204Return BitConverter.ToInt16(b, 0)
Microsoft\VisualBasic\VBMath.vb (9)
29rndSeed = BitConverter.ToInt32(BitConverter.GetBytes(Number), 0) 55lValue = BitConverter.ToInt32(BitConverter.GetBytes(sngTimer), 0) 78If BitConverter.IsLittleEndian Then 79lValue = BitConverter.ToInt32(BitConverter.GetBytes(Number), 4) 81lValue = BitConverter.ToInt32(BitConverter.GetBytes(Number), 0)
Microsoft.Win32.Registry (2)
Microsoft\Win32\RegistryKey.cs (2)
10904 => BitConverter.ToInt32(span), 10918 => BitConverter.ToInt64(span),
Mono.Cecil (10)
Mono.Cecil.PE\ByteBuffer.cs (10)
139 if (!BitConverter.IsLittleEndian) { 142 return BitConverter.ToSingle (bytes, 0); 145 float value = BitConverter.ToSingle (buffer, position); 152 if (!BitConverter.IsLittleEndian) { 155 return BitConverter.ToDouble (bytes, 0); 158 double value = BitConverter.ToDouble (buffer, position); 308 var bytes = BitConverter.GetBytes (value); 310 if (!BitConverter.IsLittleEndian) 318 var bytes = BitConverter.GetBytes (value); 320 if (!BitConverter.IsLittleEndian)
Mono.Cecil.Pdb (2)
Microsoft.Cci.Pdb\BitAccess.cs (2)
166float result = BitConverter.ToSingle(buffer, offset); 172double result = BitConverter.ToDouble(buffer, offset);
mscorlib (1)
src\runtime\src\libraries\shims\mscorlib\ref\mscorlib.cs (1)
63[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.BitConverter))]
netstandard (1)
netstandard.cs (1)
56[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.BitConverter))]
NuGet.Packaging (13)
Signing\Archive\EndOfCentralDirectoryRecord.cs (1)
111BitConverter.ToString(signature.ToArray()).Replace("-", "", StringComparison.Ordinal)));
Signing\Archive\SignedPackageArchiveUtility.cs (8)
410byte[] array = BitConverter.GetBytes(value); 411if (!BitConverter.IsLittleEndian) 420byte[] array = BitConverter.GetBytes(value); 421if (!BitConverter.IsLittleEndian) 546byte[] array = BitConverter.GetBytes(value); 547if (!BitConverter.IsLittleEndian) 556byte[] array = BitConverter.GetBytes(value); 557if (!BitConverter.IsLittleEndian)
Signing\DerEncoding\DerEncoder.cs (2)
124byte[] bytes = BitConverter.GetBytes(value); 126if (BitConverter.IsLittleEndian)
Signing\Utility\CertificateUtility.cs (2)
311return BitConverter.ToString(certificateFingerprint).Replace("-", "", StringComparison.Ordinal); 382var akiKeyIdentifier = BitConverter.ToString(keyIdentifier).Replace("-", "", StringComparison.Ordinal);
NuGet.ProjectModel (1)
FnvHash64Function.cs (1)
41return BitConverter.GetBytes(_hash);
PresentationFramework (2)
MS\Internal\WindowsRuntime\Generated\WinRT\GuidGenerator.cs (1)
105if (BitConverter.IsLittleEndian)
System\Windows\Markup\Baml2006\Baml2006Reader.cs (1)
1810value = BitConverter.GetBytes(valueId);
RepoTasks (12)
Uuid.cs (12)
28int timeLow = IPAddress.HostToNetworkOrder(BitConverter.ToInt32(namespaceBytes, 0)); 30short timeMid = IPAddress.HostToNetworkOrder(BitConverter.ToInt16(namespaceBytes, 4)); 32short timeHiVersion = IPAddress.HostToNetworkOrder(BitConverter.ToInt16(namespaceBytes, 6)); 38Buffer.BlockCopy(BitConverter.GetBytes(timeLow), 0, hashBuffer, 0, 4); 39Buffer.BlockCopy(BitConverter.GetBytes(timeMid), 0, hashBuffer, 4, 2); 40Buffer.BlockCopy(BitConverter.GetBytes(timeHiVersion), 0, hashBuffer, 6, 2); 53timeLow = IPAddress.NetworkToHostOrder(BitConverter.ToInt32(hash, 0)); 54Buffer.BlockCopy(BitConverter.GetBytes(timeLow), 0, hash, 0, 4); 57timeMid = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(hash, 4)); 58Buffer.BlockCopy(BitConverter.GetBytes(timeMid), 0, hash, 4, 2); 61timeHiVersion = IPAddress.NetworkToHostOrder(BitConverter.ToInt16(hash, 6)); 65Buffer.BlockCopy(BitConverter.GetBytes(timeHiVersion), 0, hash, 6, 2);
Roslyn.Diagnostics.Analyzers (9)
src\roslyn\src\Compilers\Core\Portable\Collections\Boxes.cs (1)
89return BitConverter.DoubleToInt64Bits(d) == 0 ? BoxedDoubleZero : d;
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHash128.cs (1)
223if (BitConverter.IsLittleEndian)
src\roslyn\src\Compilers\Core\Portable\Hashing\XxHashShared.cs (4)
161static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 793BitConverter.IsLittleEndian ? 799BitConverter.IsLittleEndian ? 806if (!BitConverter.IsLittleEndian)
src\roslyn\src\RoslynAnalyzers\Utilities\Compiler\RoslynHashCode.cs (1)
84return BitConverter.ToUInt32(array, 0);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectReader.cs (1)
45Debug.Assert(BitConverter.IsLittleEndian);
src\roslyn\src\Workspaces\SharedUtilitiesAndExtensions\Compiler\Core\Serialization\ObjectWriter.cs (1)
92Debug.Assert(BitConverter.IsLittleEndian);
rzc (4)
ServerProtocol\ServerRequest.cs (2)
129var length = BitConverter.ToInt32(lengthBuffer, 0); 199.WriteAsync(BitConverter.GetBytes(length), 0, 4, cancellationToken)
ServerProtocol\ServerResponse.cs (2)
69.WriteAsync(BitConverter.GetBytes(length), 0, 4, cancellationToken) 95var length = BitConverter.ToUInt32(lengthBuffer, 0);
System.Data.Common (10)
System\Data\Common\ObjectStorage.cs (10)
255_values[recordNo] = BitConverter.GetBytes((bool)value); 259_values[recordNo] = BitConverter.GetBytes((char)value); 263_values[recordNo] = BitConverter.GetBytes((short)value); 267_values[recordNo] = BitConverter.GetBytes((int)value); 271_values[recordNo] = BitConverter.GetBytes((long)value); 275_values[recordNo] = BitConverter.GetBytes((ushort)value); 279_values[recordNo] = BitConverter.GetBytes((uint)value); 283_values[recordNo] = BitConverter.GetBytes((ulong)value); 287_values[recordNo] = BitConverter.GetBytes((float)value); 291_values[recordNo] = BitConverter.GetBytes((double)value);
System.Data.Odbc (14)
Common\System\Data\ProviderBase\DbBuffer.cs (8)
206return BitConverter.Int64BitsToDouble(value); 368return BitConverter.Int32BitsToSingle(value); 486WriteInt64(offset, BitConverter.DoubleToInt64Bits(value)); 639WriteInt32(offset, BitConverter.SingleToInt32Bits(value)); 753buffer[0] = BitConverter.ToInt32(bits, 4); // low 754buffer[1] = BitConverter.ToInt32(bits, 8); // mid 755buffer[2] = BitConverter.ToInt32(bits, 12); // high 756if (0 != BitConverter.ToInt32(bits, 16))
System\Data\Odbc\OdbcConnection.cs (6)
399value = (BitConverter.IsLittleEndian ? Encoding.Unicode : Encoding.BigEndianUnicode).GetString(buffer, 0, Math.Min(cbActual, buffer.Length)); 425retval = BitConverter.ToInt32(buffer, 0); 458resultValue = BitConverter.ToInt16(buffer, 0); 466resultValue = BitConverter.ToInt32(buffer, 0); 474return BitConverter.ToInt32(buffer, 0); 501value = (BitConverter.IsLittleEndian ? Encoding.Unicode : Encoding.BigEndianUnicode).GetString(buffer, 0, Math.Min(cbActual, buffer.Length));
System.Data.OleDb (8)
System\Data\ProviderBase\DbBuffer.cs (8)
179return BitConverter.Int64BitsToDouble(value); 341return BitConverter.Int32BitsToSingle(value); 459WriteInt64(offset, BitConverter.DoubleToInt64Bits(value)); 612WriteInt32(offset, BitConverter.SingleToInt32Bits(value)); 706buffer[0] = BitConverter.ToInt32(bits, 4); // low 707buffer[1] = BitConverter.ToInt32(bits, 8); // mid 708buffer[2] = BitConverter.ToInt32(bits, 12); // high 709if (0 != BitConverter.ToInt32(bits, 16))
System.Diagnostics.DiagnosticSource (6)
System\Diagnostics\Activity.cs (2)
2039if (BitConverter.IsLittleEndian) 2196if (BitConverter.IsLittleEndian)
System\Diagnostics\Metrics\Base2ExponentialHistogramAggregator.cs (2)
126_scalingFactor = BitConverter.Int64BitsToDouble(0x71547652B82FEL | ((0x3FFL + value) << FractionWidth)); 236var bits = BitConverter.DoubleToInt64Bits(value);
System\Diagnostics\Metrics\ExponentialHistogramAggregator.cs (2)
181ulong bits = (ulong)BitConverter.DoubleToInt64Bits(measurement); 207return BitConverter.Int64BitsToDouble(bits);
System.Diagnostics.PerformanceCounter (2)
System\Diagnostics\PerformanceCounterLib.cs (2)
1716return (long)BitConverter.ToUInt32(data.Slice(_offset)); 1720return BitConverter.ToInt64(data.Slice(_offset));
System.Drawing.Common (4)
System\Drawing\Icon.cs (2)
772int iconSignature1 = BitConverter.ToInt32(_iconData, (int)_bestImageOffset); 773int iconSignature2 = BitConverter.ToInt32(_iconData, (int)_bestImageOffset + 4);
System\Drawing\ImageInfo.cs (2)
68int delay = BitConverter.ToInt32(values, i) * 10; 94_loopCount = BitConverter.ToInt16(values);
System.Formats.Cbor (4)
System\Formats\Cbor\Writer\CborWriter.Simple.cs (2)
137return double.IsNaN(value) || BitConverter.DoubleToInt64Bits(result) == BitConverter.DoubleToInt64Bits(value);
System\Formats\Cbor\Writer\CborWriter.Simple.netcoreapp.cs (2)
40return float.IsNaN(value) || BitConverter.SingleToInt32Bits((float)result) == BitConverter.SingleToInt32Bits(value);
System.Formats.Nrbf (1)
System\Formats\Nrbf\ArraySinglePrimitiveRecord.cs (1)
160if (!BitConverter.IsLittleEndian)
System.IO.FileSystem.Watcher (4)
System\IO\FileSystemWatcher.Linux.cs (4)
894readEvent.wd = BitConverter.ToInt32(_buffer, _bufferPos); 895readEvent.mask = BitConverter.ToUInt32(_buffer, _bufferPos + 4); // +4 to get past wd 896readEvent.cookie = BitConverter.ToUInt32(_buffer, _bufferPos + 8); // +8 to get past wd, mask 897int nameLength = (int)BitConverter.ToUInt32(_buffer, _bufferPos + 12); // +12 to get past wd, mask, cookie
System.IO.Hashing (21)
System\IO\Hashing\Adler32.cs (1)
196if (BitConverter.IsLittleEndian &&
System\IO\Hashing\Crc32ParameterSet.Vectorized.cs (3)
33if (!BitConverter.IsLittleEndian || !VectorHelper.IsSupported) 152if (!BitConverter.IsLittleEndian || !VectorHelper.IsSupported) 184if (BitConverter.IsLittleEndian)
System\IO\Hashing\Crc64ParameterSet.Vectorized.cs (3)
23if (!BitConverter.IsLittleEndian || !VectorHelper.IsSupported) 161if (!BitConverter.IsLittleEndian || !VectorHelper.IsSupported) 187if (BitConverter.IsLittleEndian)
System\IO\Hashing\XxHash128.cs (1)
219if (BitConverter.IsLittleEndian)
System\IO\Hashing\XxHash3.cs (1)
108if (BitConverter.IsLittleEndian)
System\IO\Hashing\XxHashShared.cs (12)
157static ulong ReadLE64(ulong data) => BitConverter.IsLittleEndian ? data : BinaryPrimitives.ReverseEndianness(data); 484if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 492else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 520if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 551else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 625if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 637else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 732if (Vector256.IsHardwareAccelerated && BitConverter.IsLittleEndian) 743else if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 798BitConverter.IsLittleEndian ? 804BitConverter.IsLittleEndian ? 811if (!BitConverter.IsLittleEndian)
System.Memory (6)
System\Buffers\SequenceReaderExtensions.Binary.cs (6)
62if (BitConverter.IsLittleEndian) 76if (!BitConverter.IsLittleEndian) 101if (BitConverter.IsLittleEndian) 115if (!BitConverter.IsLittleEndian) 140if (BitConverter.IsLittleEndian) 154if (!BitConverter.IsLittleEndian)
System.Net.Http (7)
System\Net\Http\HttpContent.cs (2)
64$"Expected (constant): {BitConverter.ToString(preamble.ToArray())}, Actual (Encoding.GetPreamble()): {BitConverter.ToString(actualPreamble)}");
System\Net\Http\SocketsHttpHandler\ChunkedEncodingReadStream.cs (2)
335throw new HttpIOException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_chunk_header_invalid, BitConverter.ToString(currentLine.ToArray()))); 452throw new HttpIOException(HttpRequestError.InvalidResponse, SR.Format(SR.net_http_invalid_response_chunk_extension_invalid, BitConverter.ToString(lineAfterChunkSize.ToArray())));
System\Net\Http\SocketsHttpHandler\HttpConnection.cs (3)
42private static readonly ulong s_http10Bytes = BitConverter.ToUInt64("HTTP/1.0"u8); 43private static readonly ulong s_http11Bytes = BitConverter.ToUInt64("HTTP/1.1"u8); 1073ulong first8Bytes = BitConverter.ToUInt64(line);
System.Net.Http.WinHttpHandler (1)
System\Net\Http\WinHttpChannelBinding.cs (1)
62_cachedToString = BitConverter.ToString(bytes).Replace('-', ' ');
System.Net.NetworkInformation (1)
System\Net\NetworkInformation\StringParsingHelpers.Connections.cs (1)
362if (isNetworkOrder || !BitConverter.IsLittleEndian)
System.Net.Primitives (14)
System\Net\IPAddress.cs (10)
186PrivateAddress = BitConverter.ToUInt32(address); 202if (Vector128.IsHardwareAccelerated && BitConverter.IsLittleEndian) 356if (BitConverter.IsLittleEndian) 538return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(host) : host; 543return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(host) : host; 548return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(host) : host; 724BitConverter.ToUInt32(numbers), 725BitConverter.ToUInt32(numbers.Slice(4)), 726BitConverter.ToUInt32(numbers.Slice(8)), 727BitConverter.ToUInt32(numbers.Slice(12)),
System\Net\IPNetwork.cs (4)
84if (BitConverter.IsLittleEndian) 102if (BitConverter.IsLittleEndian) 243if (BitConverter.IsLittleEndian) 267if (BitConverter.IsLittleEndian)
System.Net.Security (16)
System\Net\NegotiateAuthenticationPal.ManagedNtlm.cs (16)
135readonly get => BitConverter.IsLittleEndian ? _length : BinaryPrimitives.ReverseEndianness(_length); 136set => _length = BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value); 140readonly get => BitConverter.IsLittleEndian ? _maximumLength : BinaryPrimitives.ReverseEndianness(_maximumLength); 141set => _maximumLength = BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value); 145readonly get => BitConverter.IsLittleEndian ? _payloadOffset : BinaryPrimitives.ReverseEndianness(_payloadOffset); 146set => _payloadOffset = BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value); 178readonly get => BitConverter.IsLittleEndian ? _productBuild : BinaryPrimitives.ReverseEndianness(_productBuild); 179set => _productBuild = BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value); 194readonly get => BitConverter.IsLittleEndian ? _flags : (Flags)BinaryPrimitives.ReverseEndianness((uint)_flags); 195set => _flags = BitConverter.IsLittleEndian ? value : (Flags)BinaryPrimitives.ReverseEndianness((uint)value); 219readonly get => BitConverter.IsLittleEndian ? _flags : (Flags)BinaryPrimitives.ReverseEndianness((uint)_flags); 220set => _flags = BitConverter.IsLittleEndian ? value : (Flags)BinaryPrimitives.ReverseEndianness((uint)value); 247readonly get => BitConverter.IsLittleEndian ? _flags : (Flags)BinaryPrimitives.ReverseEndianness((uint)_flags); 248set => _flags = BitConverter.IsLittleEndian ? value : (Flags)BinaryPrimitives.ReverseEndianness((uint)value); 268readonly get => BitConverter.IsLittleEndian ? _time : BinaryPrimitives.ReverseEndianness(_time); 269set => _time = BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value);
System.Net.Sockets (1)
System\Net\Sockets\SocketPal.Unix.cs (1)
1411BitConverter.TryWriteBytes(optionOutValue, result);
System.Net.WebSockets (2)
System\Net\WebSockets\ManagedWebSocket.cs (2)
1662BitConverter.ToInt32(buffer.Slice(maskOffset)); 1693int rolledMask = BitConverter.IsLittleEndian ?
System.Numerics.Tensors (35)
System\Numerics\Tensors\netcore\TensorPrimitives.BitDecrement.cs (8)
57Vector128<uint> specialValue = Vector128.Create(BitConverter.SingleToUInt32Bits(-float.Epsilon)) & isPositiveZero; 79Vector128<ulong> specialValue = Vector128.Create(BitConverter.DoubleToUInt64Bits(-double.Epsilon)) & isPositiveZero; 108Vector256<uint> specialValue = Vector256.Create(BitConverter.SingleToUInt32Bits(-float.Epsilon)) & isPositiveZero; 130Vector256<ulong> specialValue = Vector256.Create(BitConverter.DoubleToUInt64Bits(-double.Epsilon)) & isPositiveZero; 159Vector512<uint> specialValue = Vector512.Create(BitConverter.SingleToUInt32Bits(-float.Epsilon)) & isPositiveZero; 181Vector512<ulong> specialValue = Vector512.Create(BitConverter.DoubleToUInt64Bits(-double.Epsilon)) & isPositiveZero; 205public static short Invoke(short x) => BitConverter.HalfToInt16Bits(Half.BitDecrement(BitConverter.Int16BitsToHalf(x)));
System\Numerics\Tensors\netcore\TensorPrimitives.BitIncrement.cs (2)
205public static short Invoke(short x) => BitConverter.HalfToInt16Bits(Half.BitIncrement(BitConverter.Int16BitsToHalf(x)));
System\Numerics\Tensors\netcore\TensorPrimitives.Half.cs (25)
110BitConverter.HalfToInt16Bits((Half)(object)y!), 127BitConverter.HalfToInt16Bits((Half)(object)x!), 164BitConverter.HalfToInt16Bits((Half)(object)y!), 200BitConverter.HalfToInt16Bits((Half)(object)y!), 214result = (T)(object)BitConverter.Int16BitsToHalf( 253BitConverter.HalfToInt16Bits((Half)(object)y!), 273BitConverter.HalfToInt16Bits((Half)(object)z!), 291BitConverter.HalfToInt16Bits((Half)(object)y!), 292BitConverter.HalfToInt16Bits((Half)(object)z!), 316BitConverter.HalfToInt16Bits( 317(Half)TUnary.Invoke((float)BitConverter.Int16BitsToHalf(x))); 351BitConverter.HalfToInt16Bits((Half)TBinary.Invoke( 352(float)BitConverter.Int16BitsToHalf(x), 353(float)BitConverter.Int16BitsToHalf(y))); 390BitConverter.HalfToInt16Bits((Half)TAggregate.Invoke( 391(float)BitConverter.Int16BitsToHalf(x), 392(float)BitConverter.Int16BitsToHalf(y))); 424return BitConverter.HalfToInt16Bits((Half)TAggregate.Invoke( 432return BitConverter.HalfToInt16Bits((Half)TAggregate.Invoke( 440return BitConverter.HalfToInt16Bits((Half)TAggregate.Invoke( 445public static short IdentityValue => BitConverter.HalfToInt16Bits((Half)TAggregate.IdentityValue); 455BitConverter.HalfToInt16Bits((Half)TTernary.Invoke( 456(float)BitConverter.Int16BitsToHalf(x), 457(float)BitConverter.Int16BitsToHalf(y), 458(float)BitConverter.Int16BitsToHalf(z)));
System.Private.CoreLib (516)
src\runtime\src\libraries\Common\src\System\HexConverter.cs (2)
279if (BitConverter.IsLittleEndian && (Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) && 291if (BitConverter.IsLittleEndian && (Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) &&
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadBigEndian.cs (36)
24return BitConverter.IsLittleEndian ? 25BitConverter.Int64BitsToDouble(ReverseEndianness(MemoryMarshal.Read<long>(source))) : 41return BitConverter.IsLittleEndian ? 42BitConverter.Int16BitsToHalf(ReverseEndianness(MemoryMarshal.Read<short>(source))) : 58return BitConverter.IsLittleEndian ? 59BitConverter.Int16BitsToBFloat16(ReverseEndianness(MemoryMarshal.Read<short>(source))) : 75return BitConverter.IsLittleEndian ? 92return BitConverter.IsLittleEndian ? 109return BitConverter.IsLittleEndian ? 126return BitConverter.IsLittleEndian ? 143return BitConverter.IsLittleEndian ? 160return BitConverter.IsLittleEndian ? 161BitConverter.Int32BitsToSingle(ReverseEndianness(MemoryMarshal.Read<int>(source))) : 178return BitConverter.IsLittleEndian ? 196return BitConverter.IsLittleEndian ? 214return BitConverter.IsLittleEndian ? 232return BitConverter.IsLittleEndian ? 250return BitConverter.IsLittleEndian ? 267if (BitConverter.IsLittleEndian) 270value = BitConverter.Int64BitsToDouble(ReverseEndianness(tmp)); 289if (BitConverter.IsLittleEndian) 292value = BitConverter.Int16BitsToHalf(ReverseEndianness(tmp)); 311if (BitConverter.IsLittleEndian) 314value = BitConverter.Int16BitsToBFloat16(ReverseEndianness(tmp)); 333if (BitConverter.IsLittleEndian) 355if (BitConverter.IsLittleEndian) 377if (BitConverter.IsLittleEndian) 399if (BitConverter.IsLittleEndian) 421if (BitConverter.IsLittleEndian) 442if (BitConverter.IsLittleEndian) 445value = BitConverter.Int32BitsToSingle(ReverseEndianness(tmp)); 465if (BitConverter.IsLittleEndian) 488if (BitConverter.IsLittleEndian) 511if (BitConverter.IsLittleEndian) 534if (BitConverter.IsLittleEndian) 558if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.ReadLittleEndian.cs (36)
24return !BitConverter.IsLittleEndian ? 25BitConverter.Int64BitsToDouble(ReverseEndianness(MemoryMarshal.Read<long>(source))) : 41return !BitConverter.IsLittleEndian ? 42BitConverter.Int16BitsToHalf(ReverseEndianness(MemoryMarshal.Read<short>(source))) : 58return !BitConverter.IsLittleEndian ? 59BitConverter.Int16BitsToBFloat16(ReverseEndianness(MemoryMarshal.Read<short>(source))) : 75return !BitConverter.IsLittleEndian ? 92return !BitConverter.IsLittleEndian ? 109return !BitConverter.IsLittleEndian ? 126return !BitConverter.IsLittleEndian ? 143return !BitConverter.IsLittleEndian ? 160return !BitConverter.IsLittleEndian ? 161BitConverter.Int32BitsToSingle(ReverseEndianness(MemoryMarshal.Read<int>(source))) : 178return !BitConverter.IsLittleEndian ? 196return !BitConverter.IsLittleEndian ? 214return !BitConverter.IsLittleEndian ? 232return !BitConverter.IsLittleEndian ? 250return !BitConverter.IsLittleEndian ? 267if (!BitConverter.IsLittleEndian) 270value = BitConverter.Int64BitsToDouble(ReverseEndianness(tmp)); 289if (!BitConverter.IsLittleEndian) 292value = BitConverter.Int16BitsToHalf(ReverseEndianness(tmp)); 311if (!BitConverter.IsLittleEndian) 314value = BitConverter.Int16BitsToBFloat16(ReverseEndianness(tmp)); 333if (BitConverter.IsLittleEndian) 355if (BitConverter.IsLittleEndian) 377if (BitConverter.IsLittleEndian) 399if (BitConverter.IsLittleEndian) 421if (BitConverter.IsLittleEndian) 442if (!BitConverter.IsLittleEndian) 445value = BitConverter.Int32BitsToSingle(ReverseEndianness(tmp)); 465if (BitConverter.IsLittleEndian) 488if (BitConverter.IsLittleEndian) 511if (BitConverter.IsLittleEndian) 534if (BitConverter.IsLittleEndian) 557if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteBigEndian.cs (36)
24if (BitConverter.IsLittleEndian) 26long tmp = ReverseEndianness(BitConverter.DoubleToInt64Bits(value)); 47if (BitConverter.IsLittleEndian) 49short tmp = ReverseEndianness(BitConverter.HalfToInt16Bits(value)); 70if (BitConverter.IsLittleEndian) 72short tmp = ReverseEndianness(BitConverter.BFloat16ToInt16Bits(value)); 93if (BitConverter.IsLittleEndian) 116if (BitConverter.IsLittleEndian) 139if (BitConverter.IsLittleEndian) 162if (BitConverter.IsLittleEndian) 185if (BitConverter.IsLittleEndian) 208if (BitConverter.IsLittleEndian) 210int tmp = ReverseEndianness(BitConverter.SingleToInt32Bits(value)); 232if (BitConverter.IsLittleEndian) 256if (BitConverter.IsLittleEndian) 280if (BitConverter.IsLittleEndian) 304if (BitConverter.IsLittleEndian) 328if (BitConverter.IsLittleEndian) 351if (BitConverter.IsLittleEndian) 353long tmp = ReverseEndianness(BitConverter.DoubleToInt64Bits(value)); 372if (BitConverter.IsLittleEndian) 374short tmp = ReverseEndianness(BitConverter.HalfToInt16Bits(value)); 393if (BitConverter.IsLittleEndian) 395short tmp = ReverseEndianness(BitConverter.BFloat16ToInt16Bits(value)); 414if (BitConverter.IsLittleEndian) 435if (BitConverter.IsLittleEndian) 456if (BitConverter.IsLittleEndian) 477if (BitConverter.IsLittleEndian) 498if (BitConverter.IsLittleEndian) 519if (BitConverter.IsLittleEndian) 521int tmp = ReverseEndianness(BitConverter.SingleToInt32Bits(value)); 541if (BitConverter.IsLittleEndian) 563if (BitConverter.IsLittleEndian) 585if (BitConverter.IsLittleEndian) 607if (BitConverter.IsLittleEndian) 629if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Binary\BinaryPrimitives.WriteLittleEndian.cs (36)
24if (!BitConverter.IsLittleEndian) 26long tmp = ReverseEndianness(BitConverter.DoubleToInt64Bits(value)); 47if (!BitConverter.IsLittleEndian) 49short tmp = ReverseEndianness(BitConverter.HalfToInt16Bits(value)); 70if (!BitConverter.IsLittleEndian) 72short tmp = ReverseEndianness(BitConverter.BFloat16ToInt16Bits(value)); 93if (!BitConverter.IsLittleEndian) 116if (!BitConverter.IsLittleEndian) 139if (!BitConverter.IsLittleEndian) 162if (!BitConverter.IsLittleEndian) 185if (!BitConverter.IsLittleEndian) 208if (!BitConverter.IsLittleEndian) 210int tmp = ReverseEndianness(BitConverter.SingleToInt32Bits(value)); 232if (!BitConverter.IsLittleEndian) 256if (!BitConverter.IsLittleEndian) 280if (!BitConverter.IsLittleEndian) 304if (!BitConverter.IsLittleEndian) 328if (!BitConverter.IsLittleEndian) 351if (!BitConverter.IsLittleEndian) 353long tmp = ReverseEndianness(BitConverter.DoubleToInt64Bits(value)); 372if (!BitConverter.IsLittleEndian) 374short tmp = ReverseEndianness(BitConverter.HalfToInt16Bits(value)); 393if (!BitConverter.IsLittleEndian) 395short tmp = ReverseEndianness(BitConverter.BFloat16ToInt16Bits(value)); 414if (!BitConverter.IsLittleEndian) 435if (!BitConverter.IsLittleEndian) 456if (!BitConverter.IsLittleEndian) 477if (!BitConverter.IsLittleEndian) 498if (!BitConverter.IsLittleEndian) 519if (!BitConverter.IsLittleEndian) 521int tmp = ReverseEndianness(BitConverter.SingleToInt32Bits(value)); 541if (!BitConverter.IsLittleEndian) 563if (!BitConverter.IsLittleEndian) 585if (!BitConverter.IsLittleEndian) 607if (!BitConverter.IsLittleEndian) 629if (!BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64DecoderHelper.cs (4)
92if ((Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) && BitConverter.IsLittleEndian && (end >= src)) 390if ((Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) && BitConverter.IsLittleEndian && (end >= src)) 1014Debug.Assert((Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) && BitConverter.IsLittleEndian); 1178Debug.Assert((Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) && BitConverter.IsLittleEndian);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Helper\Base64EncoderHelper.cs (4)
75if ((Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) && BitConverter.IsLittleEndian && (end >= src)) 665if (BitConverter.IsLittleEndian) 687if (BitConverter.IsLittleEndian) 912if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Buffers\Text\Base64Url\Base64UrlEncoder.cs (1)
258if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Collections\BitArray.cs (6)
93if (BitConverter.IsLittleEndian) 163if (!BitConverter.IsLittleEndian || values.Length < Vector256<byte>.Count) 255if (BitConverter.IsLittleEndian) 692if (BitConverter.IsLittleEndian) 738if (!BitConverter.IsLittleEndian || _bitLength < BitsPerInt32) 960BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipeEventProvider.cs (1)
32id = BitConverter.ToUInt64(new ReadOnlySpan<byte>(additionalData, sizeof(ulong)));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Diagnostics\Tracing\EventPipePayloadDecoder.cs (1)
129decodedFields[i] = BitConverter.IsLittleEndian ? new string(charPayload) : Encoding.Unicode.GetString(MemoryMarshal.Cast<char, byte>(charPayload));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Double.cs (43)
125ulong bits = BitConverter.DoubleToUInt64Bits(m_value); 150ulong bits = BitConverter.DoubleToUInt64Bits(m_value); 165internal static double CreateDouble(bool sign, ushort exp, ulong sig) => BitConverter.UInt64BitsToDouble((sign ? SignMask : 0UL) + ((ulong)exp << BiasedExponentShift) + sig); 173ulong bits = BitConverter.DoubleToUInt64Bits(d); 182ulong bits = BitConverter.DoubleToUInt64Bits(Abs(d)); 203ulong bits = BitConverter.DoubleToUInt64Bits(d); 212return BitConverter.DoubleToInt64Bits(d) < 0; 229ulong bits = BitConverter.DoubleToUInt64Bits(Abs(d)); 247ulong bits = BitConverter.DoubleToUInt64Bits(Abs(d)); 346ulong bits = BitConverter.DoubleToUInt64Bits(m_value); 542static double IBinaryNumber<double>.AllBitsSet => BitConverter.UInt64BitsToDouble(0xFFFF_FFFF_FFFF_FFFF); 547ulong bits = BitConverter.DoubleToUInt64Bits(value); 584ulong bits = BitConverter.DoubleToUInt64Bits(left) & BitConverter.DoubleToUInt64Bits(right); 585return BitConverter.UInt64BitsToDouble(bits); 591ulong bits = BitConverter.DoubleToUInt64Bits(left) | BitConverter.DoubleToUInt64Bits(right); 592return BitConverter.UInt64BitsToDouble(bits); 598ulong bits = BitConverter.DoubleToUInt64Bits(left) ^ BitConverter.DoubleToUInt64Bits(right); 599return BitConverter.UInt64BitsToDouble(bits); 605ulong bits = ~BitConverter.DoubleToUInt64Bits(value); 606return BitConverter.UInt64BitsToDouble(bits); 1137public static bool IsPositive(double value) => BitConverter.DoubleToInt64Bits(value) >= 0; 1566ulong xBits = BitConverter.DoubleToUInt64Bits(ax); 1567ulong yBits = BitConverter.DoubleToUInt64Bits(ay); 1601ax = BitConverter.UInt64BitsToDouble(xBits); 1604xBits = BitConverter.DoubleToUInt64Bits(ax); 1611ay = BitConverter.UInt64BitsToDouble(yBits); 1614yBits = BitConverter.DoubleToUInt64Bits(ay); 1618ax = BitConverter.UInt64BitsToDouble(xBits); 1619ay = BitConverter.UInt64BitsToDouble(yBits); 1639double xHead = BitConverter.UInt64BitsToDouble(xBits & 0xFFFF_FFFF_F800_0000); 1640double yHead = BitConverter.UInt64BitsToDouble(yBits & 0xFFFF_FFFF_F800_0000); 1958long bits = BitConverter.DoubleToInt64Bits(ax); 2099long bits = BitConverter.DoubleToInt64Bits(ax); 2276long bits = BitConverter.DoubleToInt64Bits(ax); 2367static double IBinaryFloatParseAndFormatInfo<double>.BitsToFloat(ulong bits) => BitConverter.UInt64BitsToDouble(bits); 2369static ulong IBinaryFloatParseAndFormatInfo<double>.FloatToBits(double value) => BitConverter.DoubleToUInt64Bits(value); 2549ulong bits = BitConverter.DoubleToUInt64Bits(result); 2552double z1 = BitConverter.UInt64BitsToDouble(bits); 2557bits = BitConverter.DoubleToUInt64Bits(reciprocal); 2560double reciprocalHead = BitConverter.UInt64BitsToDouble(bits);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Enum.cs (1)
2259if (!BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Globalization\CharUnicodeInfo.cs (8)
267if (BitConverter.IsLittleEndian) 275return BitConverter.UInt64BitsToDouble(temp); 289int delta = (BitConverter.IsLittleEndian) ? rsDelta : BinaryPrimitives.ReverseEndianness(rsDelta); 308int delta = (BitConverter.IsLittleEndian) ? rsDelta : BinaryPrimitives.ReverseEndianness(rsDelta); 324int delta = (BitConverter.IsLittleEndian) ? rsDelta : BinaryPrimitives.ReverseEndianness(rsDelta); 343int delta = (BitConverter.IsLittleEndian) ? rsDelta : BinaryPrimitives.ReverseEndianness(rsDelta); 490if (BitConverter.IsLittleEndian) 527if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Guid.cs (13)
75if (!BitConverter.IsLittleEndian) 92if (BitConverter.IsLittleEndian == bigEndian) 551if (!BitConverter.IsLittleEndian) 588result._de = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness((ushort)uintTmp) : (ushort)uintTmp; 591result._fg = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness((ushort)uintTmp) : (ushort)uintTmp; 596result._hijk = BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(uintTmp) : uintTmp; 639if (!BitConverter.IsLittleEndian) 1002if (BitConverter.IsLittleEndian) 1020if (BitConverter.IsLittleEndian != bigEndian) 1039if (BitConverter.IsLittleEndian) 1061if (BitConverter.IsLittleEndian != bigEndian) 1349if ((Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) && BitConverter.IsLittleEndian) 1520Debug.Assert((Ssse3.IsSupported || AdvSimd.Arm64.IsSupported || PackedSimd.IsSupported) && BitConverter.IsLittleEndian);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Half.cs (20)
589ulong doubleInt = BitConverter.DoubleToUInt64Bits(value); 760uint bitValue = BitConverter.SingleToUInt32Bits(value); 770uint exponentOffset0 = BitConverter.SingleToUInt32Bits(float.Max(value, BitConverter.UInt32BitsToSingle(MinExp))); 776value += BitConverter.UInt32BitsToSingle(exponentOffset0); 777bitValue = BitConverter.SingleToUInt32Bits(value); 795return BitConverter.UInt16BitsToHalf((ushort)bitValue); 1027return BitConverter.UInt64BitsToDouble(sign ? double.SignMask : 0); // Positive / Negative zero 1086short valueInInt16Bits = BitConverter.HalfToInt16Bits(value); 1108uint absoluteValue = BitConverter.SingleToUInt32Bits(BitConverter.UInt32BitsToSingle(bitValueInProcess) - BitConverter.UInt32BitsToSingle(maskedExponentLowerBound)); 1110return BitConverter.UInt32BitsToSingle(absoluteValue | sign); 1136return BitConverter.UInt16BitsToHalf((ushort)(signInt | NaNBits | sigInt)); 1183return BitConverter.UInt32BitsToSingle(signInt | NaNBits | sigInt); 1193return BitConverter.UInt64BitsToDouble(signInt | NaNBits | sigInt); 1217static Half IBinaryNumber<Half>.AllBitsSet => BitConverter.UInt16BitsToHalf(0xFFFF); 1222ushort bits = BitConverter.HalfToUInt16Bits(value); 2404static Half IBinaryFloatParseAndFormatInfo<Half>.BitsToFloat(ulong bits) => BitConverter.UInt16BitsToHalf((ushort)(bits)); 2406static ulong IBinaryFloatParseAndFormatInfo<Half>.FloatToBits(Half value) => BitConverter.HalfToUInt16Bits(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\HashCode.cs (8)
337Add(BitConverter.ToInt32(value)); 342Add(BitConverter.ToInt32(value)); 347Add(BitConverter.ToInt32(value)); 356_v1 = Round(_v1, BitConverter.ToUInt32(value)); 357_v2 = Round(_v2, BitConverter.ToUInt32(value.Slice(sizeof(int) * 1))); 358_v3 = Round(_v3, BitConverter.ToUInt32(value.Slice(sizeof(int) * 2))); 359_v4 = Round(_v4, BitConverter.ToUInt32(value.Slice(sizeof(int) * 3))); 369Add(BitConverter.ToInt32(value));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int128.cs (1)
544ulong bits = BitConverter.DoubleToUInt64Bits(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Int16.cs (4)
956result = (actualValue >= BitConverter.UInt16BitsToHalf(0x7800)) ? MaxValue : 957(actualValue <= BitConverter.UInt16BitsToHalf(0xF800)) ? MinValue : (short)actualValue; 1043result = (actualValue >= BitConverter.UInt16BitsToHalf(0x7800)) ? MaxValue : 1044(actualValue <= BitConverter.UInt16BitsToHalf(0xF800)) ? MinValue : (short)actualValue;
src\runtime\src\libraries\System.Private.CoreLib\src\System\IO\UnmanagedMemoryAccessor.cs (4)
258public float ReadSingle(long position) => BitConverter.Int32BitsToSingle(ReadInt32(position)); 260public double ReadDouble(long position) => BitConverter.Int64BitsToDouble(ReadInt64(position)); 490public void Write(long position, float value) => Write(position, BitConverter.SingleToInt32Bits(value)); 492public void Write(long position, double value) => Write(position, BitConverter.DoubleToInt64Bits(value));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Marvin.cs (4)
133if (BitConverter.IsLittleEndian) 164if (BitConverter.IsLittleEndian) 185if (BitConverter.IsLittleEndian) 206if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Marvin.OrdinalIgnoreCase.cs (2)
52if (BitConverter.IsLittleEndian) 63if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Math.cs (12)
129ulong raw = BitConverter.DoubleToUInt64Bits(value); 131return BitConverter.UInt64BitsToDouble(raw & mask); 139uint raw = BitConverter.SingleToUInt32Bits(value); 141return BitConverter.UInt32BitsToSingle(raw & mask); 300ulong bits = BitConverter.DoubleToUInt64Bits(x); 327return BitConverter.UInt64BitsToDouble(bits); 332ulong bits = BitConverter.DoubleToUInt64Bits(x); 359return BitConverter.UInt64BitsToDouble(bits); 378ulong xbits = BitConverter.DoubleToUInt64Bits(x); 379ulong ybits = BitConverter.DoubleToUInt64Bits(y); 383return BitConverter.UInt64BitsToDouble((xbits & ~double.SignMask) | (ybits & double.SignMask)); 1571double u = BitConverter.Int64BitsToDouble(((long)(0x3ff + n) << 52));
src\runtime\src\libraries\System.Private.CoreLib\src\System\MathF.cs (8)
52uint bits = BitConverter.SingleToUInt32Bits(x); 79return BitConverter.UInt32BitsToSingle(bits); 84uint bits = BitConverter.SingleToUInt32Bits(x); 111return BitConverter.UInt32BitsToSingle(bits); 130uint xbits = BitConverter.SingleToUInt32Bits(x); 131uint ybits = BitConverter.SingleToUInt32Bits(y); 135return BitConverter.UInt32BitsToSingle((xbits & ~float.SignMask) | (ybits & float.SignMask)); 515float u = BitConverter.Int32BitsToSingle(((int)(0x7f + n) << 23));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Cbrt.cs (2)
49double f = BitConverter.UInt64BitsToDouble((((ulong)(double.ExponentBias - 1)) << double.BiasedExponentShift) + (msd >> (64 - double.SignificandLength))); 67ulong yBits = BitConverter.DoubleToUInt64Bits(y);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.DecimalIeee754.DiyFp128Sqrt.cs (1)
317double f = BitConverter.UInt64BitsToDouble((msd >> (64 - double.SignificandLength)) + ((ulong)(double.ExponentBias - 2) << double.BiasedExponentShift));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Number.NumberToFloatingPointBits.cs (1)
959if (!BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\BFloat16.cs (9)
468ulong bitValue = BitConverter.DoubleToUInt64Bits(value); 478ulong exponentOffset0 = BitConverter.DoubleToUInt64Bits(double.Max(value, BitConverter.UInt64BitsToDouble(MinExp))); 484value += BitConverter.UInt64BitsToDouble(exponentOffset0); 485bitValue = BitConverter.DoubleToUInt64Bits(value); 548uint roundedValueBits = BitConverter.SingleToUInt32Bits(roundedValue); 588uint bits = BitConverter.SingleToUInt32Bits(value); 613uint roundedValueBits = BitConverter.SingleToUInt32Bits(roundedValue); 840public static explicit operator float(BFloat16 value) => BitConverter.Int32BitsToSingle(value._value << 16);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Colors\Argb.cs (4)
23if (BitConverter.IsLittleEndian) 41if (!BitConverter.IsLittleEndian) 61return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(bits) : bits; 76return BitConverter.IsLittleEndian ? bits : BinaryPrimitives.ReverseEndianness(bits);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\Colors\Rgba.cs (4)
23if (BitConverter.IsLittleEndian) 41if (!BitConverter.IsLittleEndian) 61return BitConverter.IsLittleEndian ? BinaryPrimitives.ReverseEndianness(bits) : bits; 76return BitConverter.IsLittleEndian ? bits : BinaryPrimitives.ReverseEndianness(bits);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Numerics\TotalOrderIeee754Comparer.cs (6)
56return CompareIntegerSemantic(BitConverter.SingleToInt32Bits((float)(object)x!), BitConverter.SingleToInt32Bits((float)(object)y!)); 60return CompareIntegerSemantic(BitConverter.DoubleToInt64Bits((double)(object)x!), BitConverter.DoubleToInt64Bits((double)(object)y!)); 64return CompareIntegerSemantic(BitConverter.HalfToInt16Bits((Half)(object)x!), BitConverter.HalfToInt16Bits((Half)(object)y!));
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (1)
398if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\InteropServices\NFloat.cs (12)
880get => (NFloat)BitConverter.UInt64BitsToDouble(0xFFFF_FFFF_FFFF_FFFF); 905ulong bits = BitConverter.DoubleToUInt64Bits(left._value) & BitConverter.DoubleToUInt64Bits(right._value); 906NativeType result = BitConverter.UInt64BitsToDouble(bits); 919ulong bits = BitConverter.DoubleToUInt64Bits(left._value) | BitConverter.DoubleToUInt64Bits(right._value); 920NativeType result = BitConverter.UInt64BitsToDouble(bits); 933ulong bits = BitConverter.DoubleToUInt64Bits(left._value) ^ BitConverter.DoubleToUInt64Bits(right._value); 934NativeType result = BitConverter.UInt64BitsToDouble(bits); 947ulong bits = ~BitConverter.DoubleToUInt64Bits(value._value); 948NativeType result = BitConverter.UInt64BitsToDouble(bits);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Runtime\Intrinsics\Scalar.cs (16)
61return (T)(object)BitConverter.Int64BitsToDouble(-1); 89return (T)(object)BitConverter.Int32BitsToSingle(-1); 728ulong bits = BitConverter.DoubleToUInt64Bits((double)(object)value); 773uint bits = BitConverter.SingleToUInt32Bits((float)(object)value); 1493long bits = BitConverter.DoubleToInt64Bits((double)(object)value); 1494double result = BitConverter.Int64BitsToDouble(bits << shiftCount); 1523int bits = BitConverter.SingleToInt32Bits((float)(object)value); 1524float result = BitConverter.Int32BitsToSingle(bits << shiftCount); 1555long bits = BitConverter.DoubleToInt64Bits((double)(object)value); 1556double result = BitConverter.Int64BitsToDouble(bits >> shiftCount); 1585int bits = BitConverter.SingleToInt32Bits((float)(object)value); 1586float result = BitConverter.Int32BitsToSingle(bits >> shiftCount); 1617long bits = BitConverter.DoubleToInt64Bits((double)(object)value); 1618double result = BitConverter.Int64BitsToDouble(bits >>> shiftCount); 1647int bits = BitConverter.SingleToInt32Bits((float)(object)value); 1648float result = BitConverter.Int32BitsToSingle(bits >>> shiftCount);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Single.cs (30)
125uint bits = BitConverter.SingleToUInt32Bits(m_value); 150uint bits = BitConverter.SingleToUInt32Bits(m_value); 165internal static float CreateSingle(bool sign, byte exp, uint sig) => BitConverter.UInt32BitsToSingle((sign ? SignMask : 0U) + ((uint)exp << BiasedExponentShift) + sig); 173uint bits = BitConverter.SingleToUInt32Bits(f); 182uint bits = BitConverter.SingleToUInt32Bits(Abs(f)); 203uint bits = BitConverter.SingleToUInt32Bits(f); 212return BitConverter.SingleToInt32Bits(f) < 0; 229uint bits = BitConverter.SingleToUInt32Bits(Abs(f)); 247uint bits = BitConverter.SingleToUInt32Bits(Abs(f)); 341uint bits = BitConverter.SingleToUInt32Bits(m_value); 537static float IBinaryNumber<float>.AllBitsSet => BitConverter.UInt32BitsToSingle(0xFFFF_FFFF); 542uint bits = BitConverter.SingleToUInt32Bits(value); 579uint bits = BitConverter.SingleToUInt32Bits(left) & BitConverter.SingleToUInt32Bits(right); 580return BitConverter.UInt32BitsToSingle(bits); 586uint bits = BitConverter.SingleToUInt32Bits(left) | BitConverter.SingleToUInt32Bits(right); 587return BitConverter.UInt32BitsToSingle(bits); 593uint bits = BitConverter.SingleToUInt32Bits(left) ^ BitConverter.SingleToUInt32Bits(right); 594return BitConverter.UInt32BitsToSingle(bits); 600uint bits = ~BitConverter.SingleToUInt32Bits(value); 601return BitConverter.UInt32BitsToSingle(bits); 1124uint bits = BitConverter.SingleToUInt32Bits(Abs(value)); 1154public static bool IsPositive(float value) => BitConverter.SingleToInt32Bits(value) >= 0; 1874int bits = BitConverter.SingleToInt32Bits(ax); 2015int bits = BitConverter.SingleToInt32Bits(ax); 2192int bits = BitConverter.SingleToInt32Bits(ax); 2283static float IBinaryFloatParseAndFormatInfo<float>.BitsToFloat(ulong bits) => BitConverter.UInt32BitsToSingle((uint)(bits)); 2285static ulong IBinaryFloatParseAndFormatInfo<float>.FloatToBits(float value) => BitConverter.SingleToUInt32Bits(value);
src\runtime\src\libraries\System.Private.CoreLib\src\System\String.Comparison.cs (4)
825if (!BitConverter.IsLittleEndian) 839if (!BitConverter.IsLittleEndian) 943if (!BitConverter.IsLittleEndian) 969if (!BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Utility.cs (21)
69if (!AdvSimd.Arm64.IsSupported || !BitConverter.IsLittleEndian) 98return (BitConverter.IsLittleEndian && (value & 0xFF80u) == 0) 99|| (!BitConverter.IsLittleEndian && (value & 0xFF800000u) == 0); 308if (!BitConverter.IsLittleEndian) 374Debug.Assert(BitConverter.IsLittleEndian, "This SSE2/Arm64 implementation assumes little-endian."); 376Vector128<byte> bitmask = BitConverter.IsLittleEndian ? 975Debug.Assert(BitConverter.IsLittleEndian, "This SSE2/Arm64 assumes little-endian."); 1295if (BitConverter.IsLittleEndian) 1328if (BitConverter.IsLittleEndian) 1354if (BitConverter.IsLittleEndian && Vector128.IsHardwareAccelerated && elementCount >= 2 * (uint)Vector128<byte>.Count) 1468if (BitConverter.IsLittleEndian) 1481if (BitConverter.IsLittleEndian) 1514if (!BitConverter.IsLittleEndian) 1727Debug.Assert(BitConverter.IsLittleEndian, "This implementation assumes little-endian."); 1845Debug.Assert(BitConverter.IsLittleEndian, "This implementation assumes little-endian."); 1962Debug.Assert(BitConverter.IsLittleEndian, "This implementation assumes little-endian."); 2078if (BitConverter.IsLittleEndian && Vector128.IsHardwareAccelerated && elementCount >= (uint)Vector128<byte>.Count) 2126if (!BitConverter.IsLittleEndian) 2133if (BitConverter.IsLittleEndian) 2171if (BitConverter.IsLittleEndian) 2298if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Ascii.Utility.Helpers.cs (1)
51if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Latin1Utility.cs (7)
186Debug.Assert(BitConverter.IsLittleEndian, "SSE2 assumes little-endian."); 551Debug.Assert(BitConverter.IsLittleEndian, "Assume little endian if SSE2 is supported."); 707if (BitConverter.IsLittleEndian) 720if (BitConverter.IsLittleEndian) 753if (!BitConverter.IsLittleEndian) 781Debug.Assert(BitConverter.IsLittleEndian); 973Debug.Assert(BitConverter.IsLittleEndian);
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Latin1Utility.Helpers.cs (4)
39return (BitConverter.IsLittleEndian && (value & 0xFF00u) == 0) 40|| (!BitConverter.IsLittleEndian && (value & 0xFF000000u) == 0); 64if (BitConverter.IsLittleEndian) 97if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf16Utility.Validation.cs (1)
289if (((thisChar - (BitConverter.IsLittleEndian ? 0xDC00_D800u : 0xD800_DC00u)) & 0xFC00_FC00u) != 0)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Helpers.cs (54)
22if (BitConverter.IsLittleEndian) 47if (BitConverter.IsLittleEndian) 67if (BitConverter.IsLittleEndian) 110if (BitConverter.IsLittleEndian) 164if (BitConverter.IsLittleEndian) 188if (BitConverter.IsLittleEndian) 216if (BitConverter.IsLittleEndian) 248return (BitConverter.IsLittleEndian && (value & 0xFF80u) == 0) 249|| (!BitConverter.IsLittleEndian && value < 0x0080_0000u); 265return (BitConverter.IsLittleEndian && (value & 0xF800u) != 0) 266|| (!BitConverter.IsLittleEndian && value >= 0x0800_0000u); 281return (BitConverter.IsLittleEndian && ((value - 0xD800u) & 0xF800u) == 0) 282|| (!BitConverter.IsLittleEndian && (value - 0xD800_0000u) < 0x0800_0000u); 301return (BitConverter.IsLittleEndian && ((value - 0x0080u) & 0xFFFFu) < 0x0780u) 302|| (!BitConverter.IsLittleEndian && UnicodeUtility.IsInRangeInclusive(value, 0x0080_0000u, 0x07FF_FFFFu)); 331return (BitConverter.IsLittleEndian && value < 0x0080_0000u) 332|| (!BitConverter.IsLittleEndian && (value & 0xFF80u) == 0); 348return (BitConverter.IsLittleEndian && (value & 0xF800_0000u) != 0) 349|| (!BitConverter.IsLittleEndian && (value & 0xF800u) != 0); 364return (BitConverter.IsLittleEndian && (value - 0xD800_0000u) < 0x0800_0000u) 365|| (!BitConverter.IsLittleEndian && ((value - 0xD800u) & 0xF800u) == 0); 384return (BitConverter.IsLittleEndian && UnicodeUtility.IsInRangeInclusive(value, 0x0080_0000u, 0x07FF_FFFFu)) 385|| (!BitConverter.IsLittleEndian && ((value - 0x0080u) & 0xFFFFu) < 0x0780u); 425return (BitConverter.IsLittleEndian && ((value - 0xDC00_D800u) & 0xFC00_FC00u) == 0) 426|| (!BitConverter.IsLittleEndian && ((value - 0xD800_DC00u) & 0xFC00_FC00u) == 0); 435if (BitConverter.IsLittleEndian) 464return (BitConverter.IsLittleEndian && ((byte)value < 0xC2u)) 465|| (!BitConverter.IsLittleEndian && (value < 0xC200_0000u)); 496return (BitConverter.IsLittleEndian && (((value - 0x8080_80F0u) & 0xC0C0_C0F8u) == 0)) 497|| (!BitConverter.IsLittleEndian && (((value - 0xF080_8080u) & 0xF8C0_C0C0u) == 0)); 528return (BitConverter.IsLittleEndian && (((value - 0x0080_80E0u) & 0x00C0_C0F0u) == 0)) 529|| (!BitConverter.IsLittleEndian && (((value - 0xE080_8000u) & 0xF0C0_C000u) == 0)); 560return (BitConverter.IsLittleEndian && (((value - 0x0000_80C0u) & 0x0000_C0E0u) == 0)) 561|| (!BitConverter.IsLittleEndian && (((value - 0xC080_0000u) & 0xE0C0_0000u) == 0)); 586return (BitConverter.IsLittleEndian && ((value & 0x001E_0000u) == 0)) 587|| (!BitConverter.IsLittleEndian && ((value & 0x1E00u) == 0)); 618return (BitConverter.IsLittleEndian && (((value - 0x80C0_0000u) & 0xC0E0_0000u) == 0)) 619|| (!BitConverter.IsLittleEndian && (((value - 0x0000_C080u) & 0x0000_E0C0u) == 0)); 639Debug.Assert(BitConverter.IsLittleEndian); 643return (BitConverter.IsLittleEndian && UnicodeUtility.IsInRangeInclusive(value & 0xC0FFu, 0x80C2u, 0x80DFu)) 644|| (!BitConverter.IsLittleEndian && false); 658Debug.Assert(BitConverter.IsLittleEndian); 662return (BitConverter.IsLittleEndian && UnicodeUtility.IsInRangeInclusive(value & 0xC0FF_0000u, 0x80C2_0000u, 0x80DF_0000u)) 663|| (!BitConverter.IsLittleEndian && false); 675return (BitConverter.IsLittleEndian && ((value & 0x80u) == 0)) 676|| (!BitConverter.IsLittleEndian && ((int)value >= 0)); 688return (BitConverter.IsLittleEndian && ((int)value >= 0)) 689|| (!BitConverter.IsLittleEndian && ((value & 0x80u) == 0)); 701return (BitConverter.IsLittleEndian && ((value & 0x8000u) == 0)) 702|| (!BitConverter.IsLittleEndian && ((value & 0x0080_0000u) == 0)); 714return (BitConverter.IsLittleEndian && ((value & 0x0080_0000u) == 0)) 715|| (!BitConverter.IsLittleEndian && ((value & 0x8000u) == 0)); 729if (BitConverter.IsLittleEndian) 763if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Transcoding.cs (15)
281if ((BitConverter.IsLittleEndian && UInt32EndsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord)) 282|| (!BitConverter.IsLittleEndian && (UInt32EndsWithUtf8TwoByteMask(thisDWord) && !UInt32EndsWithOverlongUtf8TwoByteSequence(thisDWord)))) 304if (BitConverter.IsLittleEndian) 351if (BitConverter.IsLittleEndian) 377pOutputBuffer[1] = (char)(byte)(thisDWord >> (BitConverter.IsLittleEndian ? 16 : 8)); 443if (BitConverter.IsLittleEndian) 478if (BitConverter.IsLittleEndian) 538if (BitConverter.IsLittleEndian) 593if (BitConverter.IsLittleEndian) 888if (Sse41.X64.IsSupported || (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian) || PackedSimd.IsSupported) 948if (Sse41.X64.IsSupported || (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian) || PackedSimd.IsSupported) 1176if (BitConverter.IsLittleEndian) 1263if (BitConverter.IsLittleEndian) 1372if (BitConverter.IsLittleEndian) 1452if (BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\Unicode\Utf8Utility.Validation.cs (17)
128if (AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian) 132Vector128<byte> bitMask128 = BitConverter.IsLittleEndian ? 195Debug.Assert((AdvSimd.Arm64.IsSupported && BitConverter.IsLittleEndian) || Sse2.IsSupported || PackedSimd.IsSupported); 271thisDWord -= (BitConverter.IsLittleEndian) ? 0x0000_80C0u : 0xC080_0000u; 272if ((thisDWord & (BitConverter.IsLittleEndian ? 0x0000_C0E0u : 0xE0C0_0000u)) == 0) 284if ((BitConverter.IsLittleEndian && (byte)thisDWord < 0x02u) 285|| (!BitConverter.IsLittleEndian && thisDWord < 0x0200_0000u)) 300if ((BitConverter.IsLittleEndian && UInt32EndsWithValidUtf8TwoByteSequenceLittleEndian(thisDWord)) 301|| (!BitConverter.IsLittleEndian && (UInt32EndsWithUtf8TwoByteMask(thisDWord) && !UInt32EndsWithOverlongUtf8TwoByteSequence(thisDWord)))) 314if (BitConverter.IsLittleEndian) 382thisDWord -= (BitConverter.IsLittleEndian) ? (0x0080_00E0u - 0x0000_00C0u) : (0xE000_8000u - 0xC000_0000u); 383if ((thisDWord & (BitConverter.IsLittleEndian ? 0x00C0_C0F0u : 0xF0C0_C000u)) == 0) 406if (BitConverter.IsLittleEndian) 440if (BitConverter.IsLittleEndian) 465if (IntPtr.Size >= 8 && BitConverter.IsLittleEndian) 601if (BitConverter.IsLittleEndian) 766if (!AdvSimd.Arm64.IsSupported || !BitConverter.IsLittleEndian)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Text\UnicodeEncoding.cs (8)
400if ((bigEndian ^ BitConverter.IsLittleEndian) && 444(BitConverter.IsLittleEndian ? (ulong)0xdc00d800dc00d800 : (ulong)0xd800dc00d800dc00)) 683if ((bigEndian ^ BitConverter.IsLittleEndian) && 731(BitConverter.IsLittleEndian ? (ulong)0xdc00d800dc00d800 : (ulong)0xd800dc00d800dc00)) 1031if ((bigEndian ^ BitConverter.IsLittleEndian) && 1075(BitConverter.IsLittleEndian ? (ulong)0xdc00d800dc00d800 : (ulong)0xd800dc00d800dc00)) 1339if ((bigEndian ^ BitConverter.IsLittleEndian) && 1387(BitConverter.IsLittleEndian ? (ulong)0xdc00d800dc00d800 : (ulong)0xd800dc00d800dc00))
src\runtime\src\libraries\System.Private.CoreLib\src\System\Threading\Volatile.cs (2)
50return BitConverter.Int64BitsToDouble(result); 56Write(ref Unsafe.As<double, long>(ref location), BitConverter.DoubleToInt64Bits(value));
src\runtime\src\libraries\System.Private.CoreLib\src\System\UInt128.cs (5)
261double lower = BitConverter.UInt64BitsToDouble(TwoPow52Bits | ((value._lower << 12) >> 12)) - TwoPow52; 262double upper = BitConverter.UInt64BitsToDouble(TwoPow104Bits | (ulong)(value >> 52)) - TwoPow104; 272double lower = BitConverter.UInt64BitsToDouble(TwoPow76Bits | ((ulong)(value >> 12) >> 12) | (value._lower & 0xFFFFFF)) - TwoPow76; 273double upper = BitConverter.UInt64BitsToDouble(TwoPow128Bits | (value._upper >> 12)) - TwoPow128; 558ulong bits = BitConverter.DoubleToUInt64Bits(value);
System.Private.DataContractSerialization (38)
System\Xml\XmlBinaryReader.cs (13)
1271if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int16TextWithEndElement)) 1278if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int16TextWithEndElement)) 1294if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int32TextWithEndElement)) 1301if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int32TextWithEndElement)) 1317if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int64TextWithEndElement)) 1324if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.Int64TextWithEndElement)) 1340if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement)) 1347if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.FloatTextWithEndElement)) 1363if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement)) 1370if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DoubleTextWithEndElement)) 1386if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement)) 1393if (BitConverter.IsLittleEndian && IsStartArray(localName, namespaceUri, XmlBinaryNodeType.DecimalTextWithEndElement)) 1432if (BitConverter.IsLittleEndian)
System\Xml\XmlBinaryWriter.cs (14)
134=> WriteTextNodeRaw<short>(nodeType, BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness((value))); 137=> WriteTextNodeRaw<int>(nodeType, BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness((value))); 140=> WriteTextNodeRaw<long>(nodeType, BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness((value))); 513=> WriteRaw<long>(BitConverter.IsLittleEndian ? value : BinaryPrimitives.ReverseEndianness(value)); 730if (BitConverter.IsLittleEndian) 755if (BitConverter.IsLittleEndian) 771if (BitConverter.IsLittleEndian) 867if (BitConverter.IsLittleEndian) 883if (BitConverter.IsLittleEndian) 899if (BitConverter.IsLittleEndian) 915if (BitConverter.IsLittleEndian) 933if (BitConverter.IsLittleEndian) 951if (BitConverter.IsLittleEndian) 985if (BitConverter.IsLittleEndian)
System\Xml\XmlBufferReader.cs (8)
356=> BitConverter.IsLittleEndian ? ReadRawBytes<ushort>() : BinaryPrimitives.ReverseEndianness(ReadRawBytes<ushort>()); 362=> BitConverter.IsLittleEndian ? ReadRawBytes<int>() : BinaryPrimitives.ReverseEndianness(ReadRawBytes<int>()); 373=> BitConverter.IsLittleEndian ? ReadRawBytes<long>() : BinaryPrimitives.ReverseEndianness(ReadRawBytes<long>()); 391if (BitConverter.IsLittleEndian) 952=> BitConverter.IsLittleEndian ? ReadRawBytes<short>(offset) : BinaryPrimitives.ReverseEndianness(ReadRawBytes<short>(offset)); 955=> BitConverter.IsLittleEndian ? ReadRawBytes<int>(offset) : BinaryPrimitives.ReverseEndianness(ReadRawBytes<int>(offset)); 958=> BitConverter.IsLittleEndian ? ReadRawBytes<long>(offset) : BinaryPrimitives.ReverseEndianness(ReadRawBytes<long>(offset)); 971if (BitConverter.IsLittleEndian)
System\Xml\XmlConverter.cs (2)
713return BitConverter.SingleToUInt32Bits(value) == 0x8000_0000U; 719return BitConverter.DoubleToUInt64Bits(value) == 0x8000_0000_0000_0000UL;
System\Xml\XmlStreamNodeWriter.cs (1)
338if (BitConverter.IsLittleEndian)
System.Private.Uri (7)
System\PercentEncodingHelper.cs (7)
62if (BitConverter.IsLittleEndian) 80Debug.Assert((fourByteBuffer & (BitConverter.IsLittleEndian ? 0x00000080 : 0x80000000)) != 0); 81Debug.Assert((fourByteBuffer & (BitConverter.IsLittleEndian ? 0x00008000 : 0x00800000)) != 0); 82Debug.Assert(bytesLeftInBuffer < 3 || (fourByteBuffer & (BitConverter.IsLittleEndian ? 0x00800000 : 0x00008000)) != 0); 83Debug.Assert(bytesLeftInBuffer < 4 || (fourByteBuffer & (BitConverter.IsLittleEndian ? 0x80000000 : 0x00000080)) != 0); 140if (BitConverter.IsLittleEndian) 151if (BitConverter.IsLittleEndian)
System.Private.Windows.Core (4)
System\IO\BinaryReaderExtensions.cs (2)
130if (sizeof(T) != 1 && !BitConverter.IsLittleEndian) 266if (sizeof(T) == 1 || BitConverter.IsLittleEndian)
Windows\Win32\Graphics\Gdi\ARGB.cs (2)
25Debug.Assert(BitConverter.IsLittleEndian); 35Debug.Assert(BitConverter.IsLittleEndian);
System.Private.Xml (18)
System\Xml\XmlConvert.cs (2)
1382if (value == 0 && BitConverter.DoubleToInt64Bits(value) == BitConverter.DoubleToInt64Bits(-0e0))
System\Xml\XmlEncoding.cs (2)
62if (_bigEndian == BitConverter.IsLittleEndian) 126if (_bigEndian == BitConverter.IsLittleEndian)
System\Xml\Xsl\XPathConvert.cs (14)
24return (uint)(BitConverter.DoubleToUInt64Bits(dbl) >> 32); 29return unchecked((uint)BitConverter.DoubleToUInt64Bits(dbl)); 58bits = BitConverter.DoubleToInt64Bits(y) & 1L << 63; 59return BitConverter.Int64BitsToDouble(bits | 1); 67bits = BitConverter.DoubleToInt64Bits(x); 76return BitConverter.Int64BitsToDouble(bits); 663return BitConverter.UInt64BitsToDouble((ulong)dblHi << 32 | dblLo); 1106dblT = BitConverter.Int64BitsToDouble(0x4FF00000L << 32); 1116dblT = BitConverter.UInt64BitsToDouble((ulong)dblHi << 32 | DblLo(dblT)); 1127dblT = BitConverter.UInt64BitsToDouble((ulong)dblHi << 32 | dblLo); 2789dbl = BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(dbl) - 1); 2814dbl = BitConverter.Int64BitsToDouble(BitConverter.DoubleToInt64Bits(dbl) + 1);
System.Reflection.Metadata (15)
System\Reflection\Internal\Utilities\BlobUtilities.cs (2)
20WriteUInt64(buffer, start, BitConverter.DoubleToUInt64Bits(value)); 23WriteUInt32(buffer, start, BitConverter.SingleToUInt32Bits(value));
System\Reflection\Internal\Utilities\MemoryBlock.cs (5)
68string result = BitConverter.ToString(PeekBytes(0, displayedBytes)); 131return BitConverter.IsLittleEndian ? result : BinaryPrimitives.ReverseEndianness(result); 189return BitConverter.IsLittleEndian ? result : BinaryPrimitives.ReverseEndianness(result); 246if (BitConverter.IsLittleEndian) 268if (BitConverter.IsLittleEndian)
System\Reflection\Metadata\BlobBuilder.cs (4)
1007if (BitConverter.IsLittleEndian) 1184BitConverter.ToString(bytes, 0, length) : 1185BitConverter.ToString(bytes, 0, MaxDisplaySize / 2) + "-...-" + BitConverter.ToString(bytes, length - MaxDisplaySize / 2, MaxDisplaySize / 2);
System\Reflection\Metadata\BlobReader.cs (1)
316if (BitConverter.IsLittleEndian)
System\Reflection\Metadata\BlobWriter.cs (1)
399if (BitConverter.IsLittleEndian)
System\Reflection\Metadata\Ecma335\Encoding\ControlFlowBuilder.cs (1)
320BitConverter.ToUInt32(srcBlob.Buffer, srcBlobOffset) == 0xffffffff));
System\Reflection\Metadata\Ecma335\MetadataBuilder.Heaps.cs (1)
278if (BitConverter.IsLittleEndian)
System.Resources.Extensions (1)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Resources\ResourceReader.cs (1)
398if (BitConverter.IsLittleEndian)
System.Runtime (1)
src\runtime\artifacts\obj\System.Runtime\Release\net11.0\System.Runtime.Forwards.cs (1)
51[assembly: System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.BitConverter))]
System.Runtime.Extensions (1)
System.Runtime.Extensions.cs (1)
11[assembly:System.Runtime.CompilerServices.TypeForwardedTo(typeof(System.BitConverter))]
System.Runtime.Numerics (10)
System\Number.BigInteger.cs (1)
1637if (BitConverter.IsLittleEndian)
System\Numerics\BigInteger.cs (7)
433if (!BitConverter.IsLittleEndian) 1662if (BitConverter.IsLittleEndian && sign > 0) 2179return BitConverter.UInt64BitsToDouble(result); 3621if (!BitConverter.IsLittleEndian) 3627if (!BitConverter.IsLittleEndian) 3646if (!BitConverter.IsLittleEndian) 3652if (!BitConverter.IsLittleEndian)
System\Numerics\BigIntegerCalculator.GcdInv.cs (1)
413else if (BitConverter.IsLittleEndian)
System\Numerics\NumericsHelpers.cs (1)
12ulong bits = BitConverter.DoubleToUInt64Bits(dbl);
System.Security.Cryptography (5)
src\runtime\src\libraries\Common\src\System\Security\Cryptography\DSACng.ImportExport.cs (1)
329KeyBlobMagicNumber magic = (KeyBlobMagicNumber)BitConverter.ToInt32(dsaBlob, 0);
src\runtime\src\libraries\Common\src\System\Security\Cryptography\ECCng.ImportExport.cs (1)
178KeyBlobMagicNumber magic = (KeyBlobMagicNumber)BitConverter.ToInt32(ecBlob, 0);
System\Security\Cryptography\CapiHelper.Windows.cs (2)
350impTypeReturn = BitConverter.ToInt32(impType, 0); 392permissionsReturn = BitConverter.ToInt32(permissions, 0);
System\Security\Cryptography\CngAlgorithmCore.cs (1)
67bool success = BitConverter.TryWriteBytes(keySizeBuffer, keySize);
System.Security.Cryptography.Pkcs (2)
Internal\Cryptography\Pal\Windows\HelpersWindows.cs (2)
388int provType = BitConverter.ToInt32(stackSpan.Slice(0, size)); 402int keysetType = BitConverter.ToInt32(stackSpan.Slice(0, size));
System.Text.Encoding.CodePages (6)
System\Text\BaseCodePageEncoding.cs (3)
109if (!BitConverter.IsLittleEndian) 147if (!BitConverter.IsLittleEndian) 193if (!BitConverter.IsLittleEndian)
System\Text\BaseCodePageEncoding.netcoreapp.cs (1)
20if (!BitConverter.IsLittleEndian)
System\Text\DBCSCodePageEncoding.cs (1)
47if (BitConverter.IsLittleEndian)
System\Text\SBCSCodePageEncoding.cs (1)
38if (BitConverter.IsLittleEndian)
System.Text.Encodings.Web (1)
System\Text\Encodings\Web\AllowedBmpCodePointsBitmap.cs (1)
73if (Vector.IsHardwareAccelerated && BitConverter.IsLittleEndian)
System.Text.Json (14)
src\runtime\src\libraries\System.Private.CoreLib\src\System\Marvin.cs (4)
133if (BitConverter.IsLittleEndian) 164if (BitConverter.IsLittleEndian) 185if (BitConverter.IsLittleEndian) 206if (BitConverter.IsLittleEndian)
System\Text\Json\Serialization\Metadata\PropertyRef.cs (10)
612 => BitConverter.ToUInt16(name), 623 => BitConverter.ToUInt16(name) | ((ulong)name[2] << 16), 634 => BitConverter.ToUInt32(name), 645 => BitConverter.ToUInt32(name) | ((ulong)name[4] << 32), 656 => BitConverter.ToUInt32(name) | ((ulong)BitConverter.ToUInt16(name.Slice(4, 2)) << 32), 667 => BitConverter.ToUInt32(name) | ((ulong)BitConverter.ToUInt16(name.Slice(4, 2)) << 32) | ((ulong)name[6] << 48), 67_ => BitConverter.ToUInt64(name) & 0x00ffffffffffffffUL 72if (BitConverter.IsLittleEndian)
System.Text.RegularExpressions.Generator (1)
RegexGenerator.Emitter.cs (1)
5858BitConverter.ToString(bytes).Replace("-", "");
System.Windows.Forms.Design (1)
System\ComponentModel\Design\BinaryEditor.cs (1)
87value = BitConverter.ToString(bytes);
vbc (4)
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (4)
129var length = BitConverter.ToInt32(lengthBuffer, 0); 186await outStream.WriteAsync(BitConverter.GetBytes(length), 0, 4, 302await outStream.WriteAsync(BitConverter.GetBytes(length), 325var length = BitConverter.ToUInt32(lengthBuffer, 0);
VBCSCompiler (4)
src\roslyn\src\Compilers\Shared\BuildProtocol.cs (4)
129var length = BitConverter.ToInt32(lengthBuffer, 0); 186await outStream.WriteAsync(BitConverter.GetBytes(length), 0, 4, 302await outStream.WriteAsync(BitConverter.GetBytes(length), 325var length = BitConverter.ToUInt32(lengthBuffer, 0);