-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Numericshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors
Milestone
Description
Background and Motivation
This came up while working to add Half support to the CBOR components. While not blocking to my work, these methods would be nice to have for the sake of completeness.
Proposed API
public static class BinaryPrimitives
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Half ReadHalfLittleEndian(ReadOnlySpan<byte> source);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static Half ReadHalfBigEndian(ReadOnlySpan<byte> source);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadHalfLittleEndian(ReadOnlySpan<byte> source, out Half);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryReadHalfBigEndian(ReadOnlySpan<byte> source, out Half);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void WriteHalfLittleEndian(Span<byte> destination, Half value);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void WriteHalfBigEndian(Span<byte> destination, Half value);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryWriteHalfLittleEndian(Span<byte> destination, Half value);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static bool TryWriteHalfBigEndian(Span<byte> destination, Half value);
}Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
api-approvedAPI was approved in API review, it can be implementedAPI was approved in API review, it can be implementedarea-System.Numericshelp wanted[up-for-grabs] Good issue for external contributors[up-for-grabs] Good issue for external contributors