Skip to content

BFloat16.TryWriteSignificand{Big,Little}Endian report 4 for bytesWritten #123286

@vcsjones

Description

@vcsjones

The BFloat16 implementation of TryWriteSignificandBigEndian and TryWriteSignificandLittleEndian write 16-bit integers, but report 4 as the number of bytes written (32-bit), even though only two bytes were written:

bool IFloatingPoint<BFloat16>.TryWriteSignificandBigEndian(Span<byte> destination, out int bytesWritten)
{
if (BinaryPrimitives.TryWriteUInt16BigEndian(destination, Significand))
{
bytesWritten = sizeof(uint);

I'm not exactly a numerics person but should this be a ushort? (That is what Half does).

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions