Java Code Examples for kodkod.ast.IntExpression#minus()
The following examples show how to use
kodkod.ast.IntExpression#minus() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FloatingPoint.java From quetzal with Eclipse Public License 2.0 | 6 votes |
public static IntExpression intToFloat(IntExpression intValue) { IntExpression abs = intValue.abs(); IntExpression maxSetBit = maxSetBit(abs); Formula shiftRight = maxSetBit.gt(IntConstant.constant(mantissaBits)); IntExpression re = maxSetBit.minus(IntConstant.constant(mantissaBits)); IntExpression adjustRight = adjustRight(abs, re); IntExpression le = IntConstant.constant(mantissaBits).minus(maxSetBit); IntExpression adjustLeft = abs.shl(le); IntExpression mantissa = shiftRight.thenElse(adjustRight, adjustLeft).xor(implicitOne); IntExpression exponent = maxSetBit.plus(IntConstant.constant(exponentBias)); IntExpression sign = intValue.lt(IntConstant.constant(0)) .thenElse(IntConstant.constant(1<<(exponentBits+mantissaBits)), zero); return intValue.eq(zero) .thenElse(zero, sign.or(exponent.shl(IntConstant.constant(mantissaBits))).or(mantissa)); }
Example 2
Source File: ExpressionUtil.java From quetzal with Eclipse Public License 2.0 | 4 votes |
public static IntExpression minus(IntExpression l, IntExpression r) { return l.minus(r); }