Skip to content

Commit 1d82fbe

Browse files
committed
WIP
1 parent 2c15bce commit 1d82fbe

34 files changed

+2173
-4848
lines changed

sandbox/DynamicCodeDumper/DynamicCodeDumper.csproj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,7 @@
7777
<Link>Class1.cs</Link>
7878
</Compile>
7979
</ItemGroup>
80+
<ItemGroup>
81+
<PackageReference Include="System.Memory" Version="4.5.1" />
82+
</ItemGroup>
8083
</Project>

src/MessagePack/FloatBits.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -30,23 +30,23 @@ public Float32Bits(float value)
3030
this.Value = value;
3131
}
3232

33-
public Float32Bits(byte[] bigEndianBytes, int offset)
33+
public Float32Bits(ReadOnlySpan<byte> bigEndianBytes)
3434
{
3535
this = default(Float32Bits);
3636

3737
if (BitConverter.IsLittleEndian)
3838
{
39-
this.Byte0 = bigEndianBytes[offset + 3];
40-
this.Byte1 = bigEndianBytes[offset + 2];
41-
this.Byte2 = bigEndianBytes[offset + 1];
42-
this.Byte3 = bigEndianBytes[offset];
39+
this.Byte0 = bigEndianBytes[3];
40+
this.Byte1 = bigEndianBytes[2];
41+
this.Byte2 = bigEndianBytes[1];
42+
this.Byte3 = bigEndianBytes[0];
4343
}
4444
else
4545
{
46-
this.Byte0 = bigEndianBytes[offset];
47-
this.Byte1 = bigEndianBytes[offset + 1];
48-
this.Byte2 = bigEndianBytes[offset + 2];
49-
this.Byte3 = bigEndianBytes[offset + 3];
46+
this.Byte0 = bigEndianBytes[0];
47+
this.Byte1 = bigEndianBytes[1];
48+
this.Byte2 = bigEndianBytes[2];
49+
this.Byte3 = bigEndianBytes[3];
5050
}
5151
}
5252
}
@@ -87,31 +87,31 @@ public Float64Bits(double value)
8787
this.Value = value;
8888
}
8989

90-
public Float64Bits(byte[] bigEndianBytes, int offset)
90+
public Float64Bits(ReadOnlySpan<byte> bigEndianBytes)
9191
{
9292
this = default(Float64Bits);
9393

9494
if (BitConverter.IsLittleEndian)
9595
{
96-
this.Byte0 = bigEndianBytes[offset + 7];
97-
this.Byte1 = bigEndianBytes[offset + 6];
98-
this.Byte2 = bigEndianBytes[offset + 5];
99-
this.Byte3 = bigEndianBytes[offset + 4];
100-
this.Byte4 = bigEndianBytes[offset + 3];
101-
this.Byte5 = bigEndianBytes[offset + 2];
102-
this.Byte6 = bigEndianBytes[offset + 1];
103-
this.Byte7 = bigEndianBytes[offset];
96+
this.Byte0 = bigEndianBytes[7];
97+
this.Byte1 = bigEndianBytes[6];
98+
this.Byte2 = bigEndianBytes[5];
99+
this.Byte3 = bigEndianBytes[4];
100+
this.Byte4 = bigEndianBytes[3];
101+
this.Byte5 = bigEndianBytes[2];
102+
this.Byte6 = bigEndianBytes[1];
103+
this.Byte7 = bigEndianBytes[0];
104104
}
105105
else
106106
{
107-
this.Byte0 = bigEndianBytes[offset];
108-
this.Byte1 = bigEndianBytes[offset + 1];
109-
this.Byte2 = bigEndianBytes[offset + 2];
110-
this.Byte3 = bigEndianBytes[offset + 3];
111-
this.Byte4 = bigEndianBytes[offset + 4];
112-
this.Byte5 = bigEndianBytes[offset + 5];
113-
this.Byte6 = bigEndianBytes[offset + 6];
114-
this.Byte7 = bigEndianBytes[offset + 7];
107+
this.Byte0 = bigEndianBytes[0];
108+
this.Byte1 = bigEndianBytes[1];
109+
this.Byte2 = bigEndianBytes[2];
110+
this.Byte3 = bigEndianBytes[3];
111+
this.Byte4 = bigEndianBytes[4];
112+
this.Byte5 = bigEndianBytes[5];
113+
this.Byte6 = bigEndianBytes[6];
114+
this.Byte7 = bigEndianBytes[7];
115115
}
116116
}
117117
}

0 commit comments

Comments
 (0)