Skip to content

Commit d5a179b

Browse files
committed
Add comment to clarify code intension. #213
1 parent 3915c4e commit d5a179b

2 files changed

Lines changed: 3 additions & 0 deletions

File tree

src/MsgPack/Packer.Packing.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,6 +1023,7 @@ private void PrivatePackCore( float value )
10231023

10241024
var bits = new Float32Bits( value );
10251025

1026+
// Float32Bits usage is effectively pointer dereference operation rather than shifting operators, so we must consider endianness here.
10261027
if ( BitConverter.IsLittleEndian )
10271028
{
10281029
this.WriteByte( bits.Byte3 );
@@ -1070,6 +1071,7 @@ private async Task PrivatePackAsyncCore( float value, CancellationToken cancella
10701071

10711072
var bits = new Float32Bits( value );
10721073

1074+
// Float32Bits usage is effectively pointer dereference operation rather than shifting operators, so we must consider endianness here.
10731075
if ( BitConverter.IsLittleEndian )
10741076
{
10751077
await this.WriteByteAsync( bits.Byte3, cancellationToken ).ConfigureAwait( false );

src/MsgPack/Packer.Packing.tt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -362,6 +362,7 @@ foreach ( var isAsync in new [] { false, true } )
362362

363363
var bits = new Float32Bits( value );
364364

365+
// Float32Bits usage is effectively pointer dereference operation rather than shifting operators, so we must consider endianness here.
365366
if ( BitConverter.IsLittleEndian )
366367
{
367368
<#

0 commit comments

Comments
 (0)