mirror of
https://github.com/oliverbooth/X10D
synced 2024-11-22 19:28:48 +00:00
fix: fixed Stream.ReadSingle returning wrong type
ReadSingle previously returned a double, and this never failed unit tests since float -> double is a widening conversion, with values being comparable.
This commit is contained in:
parent
b2a27cdafb
commit
677259b91c
@ -144,6 +144,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- X10D: `T[].Clear` will now correctly clear the specified range of elements by
|
- X10D: `T[].Clear` will now correctly clear the specified range of elements by
|
||||||
using the [GetOffsetAndLength](https://learn.microsoft.com/en-us/dotnet/api/system.range.getoffsetandlength?view=net-7.0)
|
using the [GetOffsetAndLength](https://learn.microsoft.com/en-us/dotnet/api/system.range.getoffsetandlength?view=net-7.0)
|
||||||
method.
|
method.
|
||||||
|
- X10D: `Stream.ReadSingle(Endianness)` now returns a float instead of a double.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Buffers.Binary;
|
using System.Buffers.Binary;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
@ -345,7 +345,7 @@ public static class StreamExtensions
|
|||||||
/// <param name="stream">The stream from which the value should be read.</param>
|
/// <param name="stream">The stream from which the value should be read.</param>
|
||||||
/// <param name="endianness">The endian encoding to use.</param>
|
/// <param name="endianness">The endian encoding to use.</param>
|
||||||
/// <returns>A single-precision floating point value read from the stream.</returns>
|
/// <returns>A single-precision floating point value read from the stream.</returns>
|
||||||
public static double ReadSingle(this Stream stream, Endianness endianness)
|
public static float ReadSingle(this Stream stream, Endianness endianness)
|
||||||
{
|
{
|
||||||
#if NET6_0_OR_GREATER
|
#if NET6_0_OR_GREATER
|
||||||
ArgumentNullException.ThrowIfNull(stream);
|
ArgumentNullException.ThrowIfNull(stream);
|
||||||
|
Loading…
Reference in New Issue
Block a user