Exemplo n.º 1
0
 private static int CompareDoubleAgainstRawType(double lhsDouble, long rhsRawBits, sbyte rhsType)
 {
     if (rhsType == BYTE || rhsType == SHORT || rhsType == INT || rhsType == LONG)
     {
         return(NumberValues.compareDoubleAgainstLong(lhsDouble, rhsRawBits));
     }
     else if (rhsType == FLOAT)
     {
         return(lhsDouble.CompareTo(Float.intBitsToFloat(( int )rhsRawBits)));
     }
     else if (rhsType == DOUBLE)
     {
         return(lhsDouble.CompareTo(Double.longBitsToDouble(rhsRawBits)));
     }
     // We can not throw here because we will visit this method inside a pageCursor.shouldRetry() block.
     // Just return a comparison that at least will be commutative.
     return(Long.compare(System.BitConverter.DoubleToInt64Bits(lhsDouble), rhsRawBits));
 }
Exemplo n.º 2
0
 private static int CompareLongAgainstRawType(long lhs, long rhsRawBits, sbyte rhsType)
 {
     if (rhsType == BYTE || rhsType == SHORT || rhsType == INT || rhsType == LONG)
     {
         return(Long.compare(lhs, rhsRawBits));
     }
     else if (rhsType == FLOAT)
     {
         return(NumberValues.compareLongAgainstDouble(lhs, Float.intBitsToFloat(( int )rhsRawBits)));
     }
     else if (rhsType == DOUBLE)
     {
         return(NumberValues.compareLongAgainstDouble(lhs, Double.longBitsToDouble(rhsRawBits)));
     }
     // We can not throw here because we will visit this method inside a pageCursor.shouldRetry() block.
     // Just return a comparison that at least will be commutative.
     return(Long.compare(lhs, rhsRawBits));
 }