18
18
using System ;
19
19
using System . Diagnostics ;
20
20
using FirebirdSql . Data . Types ;
21
- using static FirebirdSql . Data . Common . BitHelpers ;
22
21
23
22
namespace FirebirdSql . Data . Common ;
24
23
@@ -107,7 +106,7 @@ public FbDecFloat ParseBytes(byte[] decBytes)
107
106
_decimalFormat . ValidateByteLength ( decBytes ) ;
108
107
109
108
var firstByte = decBytes [ 0 ] & 0xff ;
110
- var signum = - 1 * UnsignedRightShift ( firstByte , 7 ) | 1 ;
109
+ var signum = - 1 * ( firstByte >>> 7 ) | 1 ;
111
110
var decimalType = DecimalTypeFromFirstByte ( firstByte ) ;
112
111
switch ( decimalType )
113
112
{
@@ -124,13 +123,13 @@ public FbDecFloat ParseBytes(byte[] decBytes)
124
123
int firstDigit ;
125
124
if ( ( firstByte & Combination2 ) != Combination2 )
126
125
{
127
- exponentMSB = UnsignedRightShift ( firstByte , 3 ) & 0b01100 | ( firstByte & 0b011 ) ;
128
- firstDigit = UnsignedRightShift ( firstByte , 2 ) & 0b0111 ;
126
+ exponentMSB = ( firstByte >>> 3 ) & 0b01100 | ( firstByte & 0b011 ) ;
127
+ firstDigit = ( firstByte >>> 2 ) & 0b0111 ;
129
128
}
130
129
else
131
130
{
132
- exponentMSB = UnsignedRightShift ( firstByte , 1 ) & 0b01100 | ( firstByte & 0b011 ) ;
133
- firstDigit = 0b01000 | ( UnsignedRightShift ( firstByte , 2 ) & 0b01 ) ;
131
+ exponentMSB = ( firstByte >>> 1 ) & 0b01100 | ( firstByte & 0b011 ) ;
132
+ firstDigit = 0b01000 | ( ( firstByte >>> 2 ) & 0b01 ) ;
134
133
}
135
134
var exponentBitsRemaining = _decimalFormat . ExponentContinuationBits - 2 ;
136
135
Debug . Assert ( exponentBitsRemaining == _decimalFormat . FormatBitLength - 8 - _decimalFormat . CoefficientContinuationBits , $ "Unexpected exponent remaining length { exponentBitsRemaining } .") ;
@@ -175,8 +174,8 @@ void EncodeFinite(FbDecFloat @decimal, byte[] decBytes)
175
174
var biasedExponent = _decimalFormat . BiasedExponent ( @decimal . Exponent ) ;
176
175
var coefficient = @decimal . Coefficient ;
177
176
var mostSignificantDigit = _coefficientCoder . EncodeValue ( coefficient , decBytes ) ;
178
- var expMSB = UnsignedRightShift ( biasedExponent , _decimalFormat . ExponentContinuationBits ) ;
179
- var expTwoBitCont = UnsignedRightShift ( biasedExponent , _decimalFormat . ExponentContinuationBits - 2 ) & 0b011 ;
177
+ var expMSB = biasedExponent >>> _decimalFormat . ExponentContinuationBits ;
178
+ var expTwoBitCont = ( biasedExponent >>> _decimalFormat . ExponentContinuationBits - 2 ) & 0b011 ;
180
179
if ( mostSignificantDigit <= 7 )
181
180
{
182
181
decBytes [ 0 ] |= ( byte ) ( ( expMSB << 5 )
@@ -198,7 +197,7 @@ static void EncodeExponentContinuation(byte[] decBytes, int expAndBias, int expB
198
197
var expByteIndex = 1 ;
199
198
while ( expBitsRemaining > 8 )
200
199
{
201
- decBytes [ expByteIndex ++ ] = ( byte ) UnsignedRightShift ( expAndBias , expBitsRemaining - 8 ) ;
200
+ decBytes [ expByteIndex ++ ] = ( byte ) ( expAndBias >>> expBitsRemaining - 8 ) ;
202
201
expBitsRemaining -= 8 ;
203
202
}
204
203
if ( expBitsRemaining > 0 )
@@ -219,7 +218,8 @@ static int DecodeExponent(byte[] decBytes, int exponentMSB, int exponentBitsRema
219
218
}
220
219
if ( exponentBitsRemaining > 0 )
221
220
{
222
- exponent = ( exponent << exponentBitsRemaining ) | ( UnsignedRightShift ( decBytes [ byteIndex ] & 0xFF , 8 - exponentBitsRemaining ) ) ;
221
+ exponent = ( exponent << exponentBitsRemaining )
222
+ | ( ( decBytes [ byteIndex ] & 0xFF ) >>> ( 8 - exponentBitsRemaining ) ) ;
223
223
}
224
224
return exponent ;
225
225
}
0 commit comments