public static Int64Value Neg(Int64Value a)
 {
     if (a.allBitsValid())
     {
         return(new Int64Value(-a.value));
     }
     return(createUnknown());
 }
Esempio n. 2
0
 public static Int64Value Add(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
         return new Int64Value(a.value + b.value);
     if (ReferenceEquals(a, b))
         return new Int64Value(a.value << 1, (a.validMask << 1) | 1);
     return createUnknown();
 }
 public static Bool3 compareFalse(Int64Value a)
 {
     if (a.allBitsValid())
     {
         return(a.value == 0 ? Bool3.True : Bool3.False);
     }
     if (((ulong)a.value & a.validMask) != 0)
     {
         return(Bool3.False);
     }
     return(Bool3.Unknown);
 }
 public static Int64Value Add(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         return(new Int64Value(a.value + b.value));
     }
     if (ReferenceEquals(a, b))
     {
         return(new Int64Value(a.value << 1, (a.validMask << 1) | 1));
     }
     return(createUnknown());
 }
 public static Int64Value Sub(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         return(new Int64Value(a.value - b.value));
     }
     if (ReferenceEquals(a, b))
     {
         return(zero);
     }
     return(createUnknown());
 }
 public static Bool3 compareLt_Un(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         return((ulong)a.value < (ulong)b.value ? Bool3.True : Bool3.False);
     }
     if (a.hasValue(ulong.MaxValue))
     {
         return(Bool3.False);                    // max < x => false
     }
     if (b.hasValue(ulong.MinValue))
     {
         return(Bool3.False);                    // x < min => false
     }
     return(Bool3.Unknown);
 }
 public static Bool3 compareLe(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         return(a.value <= b.value ? Bool3.True : Bool3.False);
     }
     if (a.hasValue(long.MinValue))
     {
         return(Bool3.True);                     // min <= x => true
     }
     if (b.hasValue(long.MaxValue))
     {
         return(Bool3.True);                     // x <= max => true
     }
     return(Bool3.Unknown);
 }
 public static Bool3 compareGt(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         return(a.value > b.value ? Bool3.True : Bool3.False);
     }
     if (a.hasValue(long.MinValue))
     {
         return(Bool3.False);                    // min > x => false
     }
     if (b.hasValue(long.MaxValue))
     {
         return(Bool3.False);                    // x > max => false
     }
     return(Bool3.Unknown);
 }
 public static Bool3 compareNeq(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         return(a.value != b.value ? Bool3.True : Bool3.False);
     }
     if (ReferenceEquals(a, b))
     {
         return(Bool3.False);
     }
     if (((ulong)a.value & a.validMask & b.validMask) != ((ulong)b.value & a.validMask & b.validMask))
     {
         return(Bool3.True);
     }
     return(Bool3.Unknown);
 }
Esempio n. 10
0
 public static Int64Value Rem_Un(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         try {
             return(new Int64Value((long)((ulong)a.value % (ulong)b.value)));
         }
         catch (ArithmeticException) {
             return(createUnknown());
         }
     }
     if ((ReferenceEquals(a, b) && a.isNonZero()) || b.hasValue(1))
     {
         return(zero);
     }
     return(createUnknown());
 }
Esempio n. 11
0
 public static Int64Value Mul(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         return(new Int64Value(a.value * b.value));
     }
     if (a.isZero() || b.isZero())
     {
         return(zero);
     }
     if (a.hasValue(1))
     {
         return(b);
     }
     if (b.hasValue(1))
     {
         return(a);
     }
     return(createUnknown());
 }
Esempio n. 12
0
 public static Int64Value Div(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
     {
         try {
             return(new Int64Value(a.value / b.value));
         }
         catch (ArithmeticException) {
             return(createUnknown());
         }
     }
     if (ReferenceEquals(a, b) && a.isNonZero())
     {
         return(one);
     }
     if (b.hasValue(1))
     {
         return(a);
     }
     return(createUnknown());
 }
Esempio n. 13
0
 public static Int64Value Neg(Int64Value a)
 {
     if (a.allBitsValid())
         return new Int64Value(-a.value);
     return createUnknown();
 }
Esempio n. 14
0
 public static Int64Value Mul(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
         return new Int64Value(a.value * b.value);
     if (a.isZero() || b.isZero())
         return new Int64Value(0);
     if (a.hasValue(1))
         return b;
     if (b.hasValue(1))
         return a;
     return createUnknown();
 }
Esempio n. 15
0
 public static Int64Value Div(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid()) {
         try {
             return new Int64Value(a.value / b.value);
         }
         catch (ArithmeticException) {
             return createUnknown();
         }
     }
     if (ReferenceEquals(a, b) && a.isNonZero())
         return new Int64Value(1);
     if (b.hasValue(1))
         return a;
     return createUnknown();
 }
Esempio n. 16
0
 public static Bool3 compareTrue(Int64Value a)
 {
     if (a.allBitsValid())
         return a.value != 0 ? Bool3.True : Bool3.False;
     if (((ulong)a.value & a.validMask) != 0)
         return Bool3.True;
     return Bool3.Unknown;
 }
Esempio n. 17
0
 public static Bool3 compareLt_Un(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
         return (ulong)a.value < (ulong)b.value ? Bool3.True : Bool3.False;
     if (a.hasValue(ulong.MaxValue))
         return Bool3.False;	// max < x => false
     if (b.hasValue(ulong.MinValue))
         return Bool3.False;	// x < min => false
     return Bool3.Unknown;
 }
Esempio n. 18
0
 public static Bool3 compareLe_Un(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
         return (ulong)a.value <= (ulong)b.value ? Bool3.True : Bool3.False;
     if (a.hasValue(ulong.MinValue))
         return Bool3.True;	// min <= x => true
     if (b.hasValue(ulong.MaxValue))
         return Bool3.True;	// x <= max => true
     return Bool3.Unknown;
 }
Esempio n. 19
0
 public static Int64Value Rem_Un(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid()) {
         try {
             return new Int64Value((long)((ulong)a.value % (ulong)b.value));
         }
         catch (ArithmeticException) {
             return createUnknown();
         }
     }
     if ((ReferenceEquals(a, b) && a.isNonZero()) || b.hasValue(1))
         return new Int64Value(0);
     return createUnknown();
 }
Esempio n. 20
0
 public static Int64Value Sub(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
         return new Int64Value(a.value - b.value);
     if (ReferenceEquals(a, b))
         return new Int64Value(0);
     return createUnknown();
 }
Esempio n. 21
0
 public static Bool3 compareGt(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
         return a.value > b.value ? Bool3.True : Bool3.False;
     if (a.hasValue(long.MinValue))
         return Bool3.False;	// min > x => false
     if (b.hasValue(long.MaxValue))
         return Bool3.False;	// x > max => false
     return Bool3.Unknown;
 }
Esempio n. 22
0
 public static Bool3 compareEq(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
         return a.value == b.value ? Bool3.True : Bool3.False;
     if (ReferenceEquals(a, b))
         return Bool3.True;
     if (((ulong)a.value & a.validMask & b.validMask) != ((ulong)b.value & a.validMask & b.validMask))
         return Bool3.False;
     return Bool3.Unknown;
 }
Esempio n. 23
0
 public static Bool3 compareGe(Int64Value a, Int64Value b)
 {
     if (a.allBitsValid() && b.allBitsValid())
         return a.value >= b.value ? Bool3.True : Bool3.False;
     if (a.hasValue(long.MaxValue))
         return Bool3.True;	// max >= x => true
     if (b.hasValue(long.MinValue))
         return Bool3.True;	// x >= min => true
     return Bool3.Unknown;
 }