@@ -30,23 +30,23 @@ public Float32Bits(float value)
30
30
this . Value = value ;
31
31
}
32
32
33
- public Float32Bits ( byte [ ] bigEndianBytes , int offset )
33
+ public Float32Bits ( ReadOnlySpan < byte > bigEndianBytes )
34
34
{
35
35
this = default ( Float32Bits ) ;
36
36
37
37
if ( BitConverter . IsLittleEndian )
38
38
{
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 ] ;
43
43
}
44
44
else
45
45
{
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 ] ;
50
50
}
51
51
}
52
52
}
@@ -87,31 +87,31 @@ public Float64Bits(double value)
87
87
this . Value = value ;
88
88
}
89
89
90
- public Float64Bits ( byte [ ] bigEndianBytes , int offset )
90
+ public Float64Bits ( ReadOnlySpan < byte > bigEndianBytes )
91
91
{
92
92
this = default ( Float64Bits ) ;
93
93
94
94
if ( BitConverter . IsLittleEndian )
95
95
{
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 ] ;
104
104
}
105
105
else
106
106
{
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 ] ;
115
115
}
116
116
}
117
117
}
0 commit comments