diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReadBigEndian.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReadBigEndian.cs index 07e961d22b0c2a..4065daf8621500 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReadBigEndian.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReadBigEndian.cs @@ -45,6 +45,12 @@ public static Half ReadHalfBigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 2 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static short ReadInt16BigEndian(ReadOnlySpan source) { @@ -56,6 +62,12 @@ public static short ReadInt16BigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 4 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int ReadInt32BigEndian(ReadOnlySpan source) { @@ -67,6 +79,12 @@ public static int ReadInt32BigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 8 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long ReadInt64BigEndian(ReadOnlySpan source) { @@ -78,6 +96,12 @@ public static long ReadInt64BigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 16 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Int128 ReadInt128BigEndian(ReadOnlySpan source) { @@ -89,6 +113,12 @@ public static Int128 ReadInt128BigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static nint ReadIntPtrBigEndian(ReadOnlySpan source) { @@ -117,6 +147,12 @@ public static float ReadSingleBigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 2 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ushort ReadUInt16BigEndian(ReadOnlySpan source) @@ -129,6 +165,12 @@ public static ushort ReadUInt16BigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 4 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint ReadUInt32BigEndian(ReadOnlySpan source) @@ -141,6 +183,12 @@ public static uint ReadUInt32BigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 8 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong ReadUInt64BigEndian(ReadOnlySpan source) @@ -153,6 +201,12 @@ public static ulong ReadUInt64BigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 16 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static UInt128 ReadUInt128BigEndian(ReadOnlySpan source) @@ -165,6 +219,12 @@ public static UInt128 ReadUInt128BigEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// + /// The read-only span to read. + /// The big endian value. + /// Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static nuint ReadUIntPtrBigEndian(ReadOnlySpan source) @@ -178,7 +238,7 @@ public static nuint ReadUIntPtrBigEndian(ReadOnlySpan source) /// Reads a from the beginning of a read-only span of bytes, as big endian. /// /// The read-only span of bytes to read. - /// When this method returns, the value read out of the read-only span of bytes, as big endian. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. /// /// if the span is large enough to contain a ; otherwise, . /// @@ -200,7 +260,7 @@ public static bool TryReadDoubleBigEndian(ReadOnlySpan source, out double /// Reads a from the beginning of a read-only span of bytes, as big endian. /// /// The read-only span of bytes to read. - /// When this method returns, the value read out of the read-only span of bytes, as big endian. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. /// /// if the span is large enough to contain a ; otherwise, . /// @@ -221,7 +281,12 @@ public static bool TryReadHalfBigEndian(ReadOnlySpan source, out Half valu /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 2 bytes from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadInt16BigEndian(ReadOnlySpan source, out short value) { @@ -238,7 +303,12 @@ public static bool TryReadInt16BigEndian(ReadOnlySpan source, out short va /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 4 bytes from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadInt32BigEndian(ReadOnlySpan source, out int value) { @@ -255,7 +325,12 @@ public static bool TryReadInt32BigEndian(ReadOnlySpan source, out int valu /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 8 bytes from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadInt64BigEndian(ReadOnlySpan source, out long value) { @@ -272,7 +347,12 @@ public static bool TryReadInt64BigEndian(ReadOnlySpan source, out long val /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 16 bytes from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadInt128BigEndian(ReadOnlySpan source, out Int128 value) { @@ -289,7 +369,12 @@ public static bool TryReadInt128BigEndian(ReadOnlySpan source, out Int128 /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadIntPtrBigEndian(ReadOnlySpan source, out nint value) { @@ -307,7 +392,7 @@ public static bool TryReadIntPtrBigEndian(ReadOnlySpan source, out nint va /// Reads a from the beginning of a read-only span of bytes, as big endian. /// /// The read-only span of bytes to read. - /// When this method returns, the value read out of the read-only span of bytes, as big endian. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. /// /// if the span is large enough to contain a ; otherwise, . /// @@ -327,7 +412,12 @@ public static bool TryReadSingleBigEndian(ReadOnlySpan source, out float v /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 2 bytes from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUInt16BigEndian(ReadOnlySpan source, out ushort value) @@ -345,7 +435,12 @@ public static bool TryReadUInt16BigEndian(ReadOnlySpan source, out ushort /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 4 bytes from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUInt32BigEndian(ReadOnlySpan source, out uint value) @@ -363,7 +458,12 @@ public static bool TryReadUInt32BigEndian(ReadOnlySpan source, out uint va /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 8 bytes from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUInt64BigEndian(ReadOnlySpan source, out ulong value) @@ -381,7 +481,12 @@ public static bool TryReadUInt64BigEndian(ReadOnlySpan source, out ulong v /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 16 bytes from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUInt128BigEndian(ReadOnlySpan source, out UInt128 value) @@ -399,7 +504,13 @@ public static bool TryReadUInt128BigEndian(ReadOnlySpan source, out UInt12 /// /// Reads a from the beginning of a read-only span of bytes, as big endian. /// - /// If the span is too small to contain a , return false. + + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as big endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUIntPtrBigEndian(ReadOnlySpan source, out nuint value) diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReadLittleEndian.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReadLittleEndian.cs index 8c9df7eef86927..c21624da2aafc8 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReadLittleEndian.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReadLittleEndian.cs @@ -45,6 +45,12 @@ public static Half ReadHalfLittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 2 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static short ReadInt16LittleEndian(ReadOnlySpan source) { @@ -56,6 +62,12 @@ public static short ReadInt16LittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 4 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int ReadInt32LittleEndian(ReadOnlySpan source) { @@ -67,6 +79,12 @@ public static int ReadInt32LittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 8 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long ReadInt64LittleEndian(ReadOnlySpan source) { @@ -78,6 +96,12 @@ public static long ReadInt64LittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 16 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static Int128 ReadInt128LittleEndian(ReadOnlySpan source) { @@ -89,6 +113,12 @@ public static Int128 ReadInt128LittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static nint ReadIntPtrLittleEndian(ReadOnlySpan source) { @@ -117,6 +147,12 @@ public static float ReadSingleLittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 2 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ushort ReadUInt16LittleEndian(ReadOnlySpan source) @@ -129,6 +165,12 @@ public static ushort ReadUInt16LittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 4 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static uint ReadUInt32LittleEndian(ReadOnlySpan source) @@ -141,6 +183,12 @@ public static uint ReadUInt32LittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 8 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static ulong ReadUInt64LittleEndian(ReadOnlySpan source) @@ -153,6 +201,12 @@ public static ulong ReadUInt64LittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 16 bytes from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static UInt128 ReadUInt128LittleEndian(ReadOnlySpan source) @@ -165,6 +219,12 @@ public static UInt128 ReadUInt128LittleEndian(ReadOnlySpan source) /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// + /// The read-only span to read. + /// The little endian value. + /// Reads exactly 4 bytes on 32-bit platforms or 8 bytes on 64-bit platforms from the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static nuint ReadUIntPtrLittleEndian(ReadOnlySpan source) @@ -178,7 +238,7 @@ public static nuint ReadUIntPtrLittleEndian(ReadOnlySpan source) /// Reads a from the beginning of a read-only span of bytes, as little endian. /// /// The read-only span of bytes to read. - /// When this method returns, the value read out of the read-only span of bytes, as little endian. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. /// /// if the span is large enough to contain a ; otherwise, . /// @@ -200,7 +260,7 @@ public static bool TryReadDoubleLittleEndian(ReadOnlySpan source, out doub /// Reads a from the beginning of a read-only span of bytes, as little endian. /// /// The read-only span of bytes to read. - /// When this method returns, the value read out of the read-only span of bytes, as little endian. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. /// /// if the span is large enough to contain a ; otherwise, . /// @@ -221,7 +281,12 @@ public static bool TryReadHalfLittleEndian(ReadOnlySpan source, out Half v /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 2 bytes from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadInt16LittleEndian(ReadOnlySpan source, out short value) { @@ -238,7 +303,12 @@ public static bool TryReadInt16LittleEndian(ReadOnlySpan source, out short /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 4 bytes from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadInt32LittleEndian(ReadOnlySpan source, out int value) { @@ -255,7 +325,12 @@ public static bool TryReadInt32LittleEndian(ReadOnlySpan source, out int v /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 8 bytes from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadInt64LittleEndian(ReadOnlySpan source, out long value) { @@ -272,7 +347,12 @@ public static bool TryReadInt64LittleEndian(ReadOnlySpan source, out long /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 16 bytes from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadInt128LittleEndian(ReadOnlySpan source, out Int128 value) { @@ -289,7 +369,12 @@ public static bool TryReadInt128LittleEndian(ReadOnlySpan source, out Int1 /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 4 bytes on 32-bit platforms or 8 bytes on 64-bit platforms from the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadIntPtrLittleEndian(ReadOnlySpan source, out nint value) { @@ -307,7 +392,7 @@ public static bool TryReadIntPtrLittleEndian(ReadOnlySpan source, out nint /// Reads a from the beginning of a read-only span of bytes, as little endian. /// /// The read-only span of bytes to read. - /// When this method returns, the value read out of the read-only span of bytes, as little endian. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. /// /// if the span is large enough to contain a ; otherwise, . /// @@ -327,7 +412,12 @@ public static bool TryReadSingleLittleEndian(ReadOnlySpan source, out floa /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 2 bytes from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUInt16LittleEndian(ReadOnlySpan source, out ushort value) @@ -345,7 +435,12 @@ public static bool TryReadUInt16LittleEndian(ReadOnlySpan source, out usho /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 4 bytes from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUInt32LittleEndian(ReadOnlySpan source, out uint value) @@ -363,7 +458,12 @@ public static bool TryReadUInt32LittleEndian(ReadOnlySpan source, out uint /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 8 bytes from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUInt64LittleEndian(ReadOnlySpan source, out ulong value) @@ -381,7 +481,12 @@ public static bool TryReadUInt64LittleEndian(ReadOnlySpan source, out ulon /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 16 bytes from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUInt128LittleEndian(ReadOnlySpan source, out UInt128 value) @@ -399,7 +504,12 @@ public static bool TryReadUInt128LittleEndian(ReadOnlySpan source, out UIn /// /// Reads a from the beginning of a read-only span of bytes, as little endian. /// - /// If the span is too small to contain a , return false. + /// The read-only span of bytes to read. + /// When this method returns, contains the value read out of the read-only span of bytes, as little endian. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Reads exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms from the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryReadUIntPtrLittleEndian(ReadOnlySpan source, out nuint value) diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReverseEndianness.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReverseEndianness.cs index c229efb2f3d38c..5f8b0a7e5fca7f 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReverseEndianness.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.ReverseEndianness.cs @@ -22,42 +22,53 @@ namespace System.Buffers.Binary public static partial class BinaryPrimitives { /// - /// This is a no-op and added only for consistency. - /// This allows the caller to read a struct of numeric primitives and reverse each field - /// rather than having to skip sbyte fields. + /// Reverses a primitive value by performing an endianness swap of the specified value, which effectively does nothing for an . /// + /// The value to reverse. + /// The passed-in value, unmodified. + /// This method effectively does nothing and was added only for consistency. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static sbyte ReverseEndianness(sbyte value) => value; /// - /// Reverses a primitive value - performs an endianness swap + /// Reverses a primitive value by performing an endianness swap of the specified value. /// + /// The value to reverse. + /// The reversed value. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static short ReverseEndianness(short value) => (short)ReverseEndianness((ushort)value); /// - /// Reverses a primitive value - performs an endianness swap + /// Reverses a primitive value by performing an endianness swap of the specified value. /// + /// The value to reverse. + /// The reversed value. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static int ReverseEndianness(int value) => (int)ReverseEndianness((uint)value); /// - /// Reverses a primitive value - performs an endianness swap + /// Reverses a primitive value by performing an endianness swap of the specified value. /// + /// The value to reverse. + /// The reversed value. [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static long ReverseEndianness(long value) => (long)ReverseEndianness((ulong)value); - /// Reverses a primitive value by performing an endianness swap of the specified value. + /// + /// Reverses a primitive value by performing an endianness swap of the specified value. + /// /// The value to reverse. /// The reversed value. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static nint ReverseEndianness(nint value) => (nint)ReverseEndianness((nint_t)value); - /// Reverses a primitive value by performing an endianness swap of the specified value. + /// + /// Reverses a primitive value by performing an endianness swap of the specified value. + /// /// The value to reverse. /// The reversed value. [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -70,16 +81,19 @@ public static Int128 ReverseEndianness(Int128 value) } /// - /// This is a no-op and added only for consistency. - /// This allows the caller to read a struct of numeric primitives and reverse each field - /// rather than having to skip byte fields. + /// Reverses a primitive value by performing an endianness swap of the specified value, which effectively does nothing for an . /// + /// The value to reverse. + /// The passed-in value, unmodified. + /// This method effectively does nothing and was added only for consistency. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static byte ReverseEndianness(byte value) => value; /// - /// Reverses a primitive value - performs an endianness swap + /// Reverses a primitive value by performing an endianness swap of the specified value. /// + /// The value to reverse. + /// The reversed value. [CLSCompliant(false)] [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -96,14 +110,18 @@ public static ushort ReverseEndianness(ushort value) } /// - /// Reverses a 16-bit character value - performs an endianness swap + /// Reverses a primitive value by performing an endianness swap of the specified value. /// + /// The value to reverse. + /// The reversed value. [MethodImpl(MethodImplOptions.AggressiveInlining)] internal static char ReverseEndianness(char value) => (char)ReverseEndianness((ushort)value); /// - /// Reverses a primitive value - performs an endianness swap + /// Reverses a primitive value by performing an endianness swap of the specified value. /// + /// The value to reverse. + /// The reversed value. [CLSCompliant(false)] [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -134,8 +152,10 @@ public static uint ReverseEndianness(uint value) } /// - /// Reverses a primitive value - performs an endianness swap + /// Reverses a primitive value by performing an endianness swap of the specified value. /// + /// The value to reverse. + /// The reversed value. [CLSCompliant(false)] [Intrinsic] [MethodImpl(MethodImplOptions.AggressiveInlining)] @@ -148,14 +168,18 @@ public static ulong ReverseEndianness(ulong value) + ReverseEndianness((uint)(value >> 32)); } - /// Reverses a primitive value by performing an endianness swap of the specified value. + /// + /// Reverses a primitive value by performing an endianness swap of the specified value. + /// /// The value to reverse. /// The reversed value. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static nuint ReverseEndianness(nuint value) => (nuint)ReverseEndianness((nuint_t)value); - /// Reverses a primitive value by performing an endianness swap of the specified value. + /// + /// Reverses a primitive value by performing an endianness swap of the specified value. + /// /// The value to reverse. /// The reversed value. [CLSCompliant(false)] diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.WriteBigEndian.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.WriteBigEndian.cs index 67602e99a7fc38..159ade3dbdf6f7 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.WriteBigEndian.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.WriteBigEndian.cs @@ -57,6 +57,12 @@ public static void WriteHalfBigEndian(Span destination, Half value) /// /// Writes a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 2 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteInt16BigEndian(Span destination, short value) { @@ -74,6 +80,12 @@ public static void WriteInt16BigEndian(Span destination, short value) /// /// Writes a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 4 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteInt32BigEndian(Span destination, int value) { @@ -91,6 +103,12 @@ public static void WriteInt32BigEndian(Span destination, int value) /// /// Writes a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 8 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteInt64BigEndian(Span destination, long value) { @@ -108,6 +126,12 @@ public static void WriteInt64BigEndian(Span destination, long value) /// /// Writes a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 16 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteInt128BigEndian(Span destination, Int128 value) { @@ -125,6 +149,12 @@ public static void WriteInt128BigEndian(Span destination, Int128 value) /// /// Writes a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteIntPtrBigEndian(Span destination, nint value) { @@ -165,6 +195,12 @@ public static void WriteSingleBigEndian(Span destination, float value) /// /// Write a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 2 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUInt16BigEndian(Span destination, ushort value) @@ -183,6 +219,12 @@ public static void WriteUInt16BigEndian(Span destination, ushort value) /// /// Write a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 4 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUInt32BigEndian(Span destination, uint value) @@ -201,6 +243,12 @@ public static void WriteUInt32BigEndian(Span destination, uint value) /// /// Write a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 8 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUInt64BigEndian(Span destination, ulong value) @@ -219,6 +267,12 @@ public static void WriteUInt64BigEndian(Span destination, ulong value) /// /// Writes a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 16 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUInt128BigEndian(Span destination, UInt128 value) @@ -237,6 +291,12 @@ public static void WriteUInt128BigEndian(Span destination, UInt128 value) /// /// Writes a into a span of bytes, as big endian. /// + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// Writes exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUIntPtrBigEndian(Span destination, nuint value) @@ -297,7 +357,12 @@ public static bool TryWriteHalfBigEndian(Span destination, Half value) /// /// Writes a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 2 bytes to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteInt16BigEndian(Span destination, short value) { @@ -313,7 +378,12 @@ public static bool TryWriteInt16BigEndian(Span destination, short value) /// /// Writes a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 4 bytes to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteInt32BigEndian(Span destination, int value) { @@ -329,7 +399,12 @@ public static bool TryWriteInt32BigEndian(Span destination, int value) /// /// Writes a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 8 bytes to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteInt64BigEndian(Span destination, long value) { @@ -345,7 +420,12 @@ public static bool TryWriteInt64BigEndian(Span destination, long value) /// /// Writes a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 16 bytes to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteInt128BigEndian(Span destination, Int128 value) { @@ -361,7 +441,12 @@ public static bool TryWriteInt128BigEndian(Span destination, Int128 value) /// /// Writes a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteIntPtrBigEndian(Span destination, nint value) { @@ -398,7 +483,12 @@ public static bool TryWriteSingleBigEndian(Span destination, float value) /// /// Write a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 2 bytes to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUInt16BigEndian(Span destination, ushort value) @@ -415,7 +505,12 @@ public static bool TryWriteUInt16BigEndian(Span destination, ushort value) /// /// Write a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 4 bytes to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUInt32BigEndian(Span destination, uint value) @@ -432,7 +527,12 @@ public static bool TryWriteUInt32BigEndian(Span destination, uint value) /// /// Write a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 8 bytes to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUInt64BigEndian(Span destination, ulong value) @@ -449,7 +549,12 @@ public static bool TryWriteUInt64BigEndian(Span destination, ulong value) /// /// Writes a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 16 bytes to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUInt128BigEndian(Span destination, UInt128 value) @@ -466,7 +571,12 @@ public static bool TryWriteUInt128BigEndian(Span destination, UInt128 valu /// /// Writes a into a span of bytes, as big endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as big endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUIntPtrBigEndian(Span destination, nuint value) diff --git a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.WriteLittleEndian.cs b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.WriteLittleEndian.cs index f8a92a3e4dc489..5da64da58368a5 100644 --- a/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.WriteLittleEndian.cs +++ b/src/libraries/System.Private.CoreLib/src/System/Buffers/Binary/BinaryPrimitives.WriteLittleEndian.cs @@ -57,6 +57,12 @@ public static void WriteHalfLittleEndian(Span destination, Half value) /// /// Writes a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 2 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteInt16LittleEndian(Span destination, short value) { @@ -74,6 +80,12 @@ public static void WriteInt16LittleEndian(Span destination, short value) /// /// Writes a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 4 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteInt32LittleEndian(Span destination, int value) { @@ -91,6 +103,12 @@ public static void WriteInt32LittleEndian(Span destination, int value) /// /// Writes a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 8 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteInt64LittleEndian(Span destination, long value) { @@ -108,6 +126,12 @@ public static void WriteInt64LittleEndian(Span destination, long value) /// /// Writes a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 16 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteInt128LittleEndian(Span destination, Int128 value) { @@ -125,6 +149,12 @@ public static void WriteInt128LittleEndian(Span destination, Int128 value) /// /// Writes a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms to the beginning of the span. + /// + /// is too small to contain a . + /// [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteIntPtrLittleEndian(Span destination, nint value) { @@ -165,6 +195,12 @@ public static void WriteSingleLittleEndian(Span destination, float value) /// /// Write a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 2 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUInt16LittleEndian(Span destination, ushort value) @@ -183,6 +219,12 @@ public static void WriteUInt16LittleEndian(Span destination, ushort value) /// /// Write a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 4 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUInt32LittleEndian(Span destination, uint value) @@ -201,6 +243,12 @@ public static void WriteUInt32LittleEndian(Span destination, uint value) /// /// Write a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 8 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUInt64LittleEndian(Span destination, ulong value) @@ -219,6 +267,12 @@ public static void WriteUInt64LittleEndian(Span destination, ulong value) /// /// Writes a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 16 bytes to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUInt128LittleEndian(Span destination, UInt128 value) @@ -237,6 +291,12 @@ public static void WriteUInt128LittleEndian(Span destination, UInt128 valu /// /// Writes a into a span of bytes, as little endian. /// + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// Writes exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms to the beginning of the span. + /// + /// is too small to contain a . + /// [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static void WriteUIntPtrLittleEndian(Span destination, nuint value) @@ -297,7 +357,12 @@ public static bool TryWriteHalfLittleEndian(Span destination, Half value) /// /// Writes a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 2 bytes to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteInt16LittleEndian(Span destination, short value) { @@ -313,7 +378,12 @@ public static bool TryWriteInt16LittleEndian(Span destination, short value /// /// Writes a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 4 bytes to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteInt32LittleEndian(Span destination, int value) { @@ -329,7 +399,12 @@ public static bool TryWriteInt32LittleEndian(Span destination, int value) /// /// Writes a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 8 bytes to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteInt64LittleEndian(Span destination, long value) { @@ -345,7 +420,12 @@ public static bool TryWriteInt64LittleEndian(Span destination, long value) /// /// Writes a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 16 bytes to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteInt128LittleEndian(Span destination, Int128 value) { @@ -361,7 +441,12 @@ public static bool TryWriteInt128LittleEndian(Span destination, Int128 val /// /// Writes a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms to the beginning of the span. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteIntPtrLittleEndian(Span destination, nint value) { @@ -398,7 +483,12 @@ public static bool TryWriteSingleLittleEndian(Span destination, float valu /// /// Write a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 2 bytes to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUInt16LittleEndian(Span destination, ushort value) @@ -415,7 +505,12 @@ public static bool TryWriteUInt16LittleEndian(Span destination, ushort val /// /// Write a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 4 bytes to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUInt32LittleEndian(Span destination, uint value) @@ -432,7 +527,12 @@ public static bool TryWriteUInt32LittleEndian(Span destination, uint value /// /// Write a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 8 bytes to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUInt64LittleEndian(Span destination, ulong value) @@ -449,7 +549,12 @@ public static bool TryWriteUInt64LittleEndian(Span destination, ulong valu /// /// Writes a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 16 bytes to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUInt128LittleEndian(Span destination, UInt128 value) @@ -466,7 +571,12 @@ public static bool TryWriteUInt128LittleEndian(Span destination, UInt128 v /// /// Writes a into a span of bytes, as little endian. /// - /// If the span is too small to contain the value, return false. + /// The span of bytes where the value is to be written, as little endian. + /// The value to write into the span of bytes. + /// + /// if the span is large enough to contain a ; otherwise, . + /// + /// Writes exactly 4 bytes on 32-bit platforms -or- 8 bytes on 64-bit platforms to the beginning of the span. [CLSCompliant(false)] [MethodImpl(MethodImplOptions.AggressiveInlining)] public static bool TryWriteUIntPtrLittleEndian(Span destination, nuint value) diff --git a/src/libraries/System.Private.CoreLib/src/System/SearchValues/SearchValues.cs b/src/libraries/System.Private.CoreLib/src/System/SearchValues/SearchValues.cs index 3398379bfe711b..9e606749dc925d 100644 --- a/src/libraries/System.Private.CoreLib/src/System/SearchValues/SearchValues.cs +++ b/src/libraries/System.Private.CoreLib/src/System/SearchValues/SearchValues.cs @@ -24,6 +24,7 @@ public static class SearchValues /// Creates an optimized representation of used for efficient searching. /// /// The set of values. + /// The optimized representation of used for efficient searching. public static SearchValues Create(ReadOnlySpan values) { if (values.IsEmpty) @@ -66,6 +67,7 @@ public static SearchValues Create(ReadOnlySpan values) /// Creates an optimized representation of used for efficient searching. /// /// The set of values. + /// /// The optimized representation of used for efficient searching. public static SearchValues Create(ReadOnlySpan values) { if (values.IsEmpty) @@ -167,10 +169,11 @@ ref Unsafe.As(ref MemoryMarshal.GetReference(values)), /// /// Creates an optimized representation of used for efficient searching. - /// Only or may be used. /// /// The set of values. /// Specifies whether to use or search semantics. + /// The optimized representation of used for efficient searching. + /// Only or may be used. public static SearchValues Create(ReadOnlySpan values, StringComparison comparisonType) { if (comparisonType is not (StringComparison.Ordinal or StringComparison.OrdinalIgnoreCase))