1818using System ;
1919using System . Diagnostics ;
2020using FirebirdSql . Data . Types ;
21- using static FirebirdSql . Data . Common . BitHelpers ;
2221
2322namespace FirebirdSql . Data . Common ;
2423
@@ -107,7 +106,7 @@ public FbDecFloat ParseBytes(byte[] decBytes)
107106 _decimalFormat . ValidateByteLength ( decBytes ) ;
108107
109108 var firstByte = decBytes [ 0 ] & 0xff ;
110- var signum = - 1 * UnsignedRightShift ( firstByte , 7 ) | 1 ;
109+ var signum = - 1 * ( firstByte >>> 7 ) | 1 ;
111110 var decimalType = DecimalTypeFromFirstByte ( firstByte ) ;
112111 switch ( decimalType )
113112 {
@@ -124,13 +123,13 @@ public FbDecFloat ParseBytes(byte[] decBytes)
124123 int firstDigit ;
125124 if ( ( firstByte & Combination2 ) != Combination2 )
126125 {
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 ;
129128 }
130129 else
131130 {
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 ) ;
134133 }
135134 var exponentBitsRemaining = _decimalFormat . ExponentContinuationBits - 2 ;
136135 Debug . Assert ( exponentBitsRemaining == _decimalFormat . FormatBitLength - 8 - _decimalFormat . CoefficientContinuationBits , $ "Unexpected exponent remaining length { exponentBitsRemaining } .") ;
@@ -175,8 +174,8 @@ void EncodeFinite(FbDecFloat @decimal, byte[] decBytes)
175174 var biasedExponent = _decimalFormat . BiasedExponent ( @decimal . Exponent ) ;
176175 var coefficient = @decimal . Coefficient ;
177176 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 ;
180179 if ( mostSignificantDigit <= 7 )
181180 {
182181 decBytes [ 0 ] |= ( byte ) ( ( expMSB << 5 )
@@ -198,7 +197,7 @@ static void EncodeExponentContinuation(byte[] decBytes, int expAndBias, int expB
198197 var expByteIndex = 1 ;
199198 while ( expBitsRemaining > 8 )
200199 {
201- decBytes [ expByteIndex ++ ] = ( byte ) UnsignedRightShift ( expAndBias , expBitsRemaining - 8 ) ;
200+ decBytes [ expByteIndex ++ ] = ( byte ) ( expAndBias >>> expBitsRemaining - 8 ) ;
202201 expBitsRemaining -= 8 ;
203202 }
204203 if ( expBitsRemaining > 0 )
@@ -219,7 +218,8 @@ static int DecodeExponent(byte[] decBytes, int exponentMSB, int exponentBitsRema
219218 }
220219 if ( exponentBitsRemaining > 0 )
221220 {
222- exponent = ( exponent << exponentBitsRemaining ) | ( UnsignedRightShift ( decBytes [ byteIndex ] & 0xFF , 8 - exponentBitsRemaining ) ) ;
221+ exponent = ( exponent << exponentBitsRemaining )
222+ | ( ( decBytes [ byteIndex ] & 0xFF ) >>> ( 8 - exponentBitsRemaining ) ) ;
223223 }
224224 return exponent ;
225225 }
0 commit comments