File tree Expand file tree Collapse file tree 2 files changed +14
-4
lines changed
src/FirebirdSql.Data.FirebirdClient Expand file tree Collapse file tree 2 files changed +14
-4
lines changed Original file line number Diff line number Diff line change @@ -269,8 +269,9 @@ public async ValueTask<short> ReadInt16Async(CancellationToken cancellationToken
269269
270270 public int ReadInt32 ( )
271271 {
272- ReadBytes ( _smallBuffer , 4 ) ;
273- return TypeDecoder . DecodeInt32 ( _smallBuffer ) ;
272+ Span < byte > bytes = stackalloc byte [ 4 ] ;
273+ ReadBytes ( bytes , 4 ) ;
274+ return TypeDecoder . DecodeInt32 ( bytes ) ;
274275 }
275276 public async ValueTask < int > ReadInt32Async ( CancellationToken cancellationToken = default )
276277 {
@@ -280,8 +281,9 @@ public async ValueTask<int> ReadInt32Async(CancellationToken cancellationToken =
280281
281282 public long ReadInt64 ( )
282283 {
283- ReadBytes ( _smallBuffer , 8 ) ;
284- return TypeDecoder . DecodeInt64 ( _smallBuffer ) ;
284+ Span < byte > bytes = stackalloc byte [ 8 ] ;
285+ ReadBytes ( bytes , 8 ) ;
286+ return TypeDecoder . DecodeInt64 ( bytes ) ;
285287 }
286288 public async ValueTask < long > ReadInt64Async ( CancellationToken cancellationToken = default )
287289 {
Original file line number Diff line number Diff line change @@ -124,11 +124,19 @@ public static int DecodeInt32(byte[] value)
124124 return IPAddress . HostToNetworkOrder ( BitConverter . ToInt32 ( value , 0 ) ) ;
125125 }
126126
127+ public static int DecodeInt32 ( Span < byte > value ) {
128+ return IPAddress . HostToNetworkOrder ( BitConverter . ToInt32 ( value ) ) ;
129+ }
130+
127131 public static long DecodeInt64 ( byte [ ] value )
128132 {
129133 return IPAddress . HostToNetworkOrder ( BitConverter . ToInt64 ( value , 0 ) ) ;
130134 }
131135
136+ public static long DecodeInt64 ( Span < byte > value ) {
137+ return IPAddress . HostToNetworkOrder ( BitConverter . ToInt64 ( value ) ) ;
138+ }
139+
132140 public static FbDecFloat DecodeDec16 ( byte [ ] value )
133141 {
134142 if ( BitConverter . IsLittleEndian )
You can’t perform that action at this time.
0 commit comments