Next: SelectExpression Up: ExecutionObject Previous: UnaryExpression   Contents

Unary Arithmetic Operations

Table 2: Unary Operations
 Operation Semantics and Operands negate The negate operation may be applied to a source operand with any numeric type to get a result of any other numeric type. The result is the source value with the sign reversed. invert The invert operation returns the multiplicative inverse of the input. That is, if the input is x, the result is 1/x. The invert operation may be applied to a source of any numeric type to return any other numeric type, though it's practically useless for integer types no matter how the rounding is defined. absolute_value The absolute_value operation may be applied to an operand of any numeric type to give a result of any other numeric type. bitwise_not The bitwise_not operation may be applied to any unsigned integer type operand to give back a value of any other unsigned integer type. If the result is larger, it is zero-filled while if the result it smaller than the source type the high-order bits are dropped. logical_not The logical_not operation is allowed for a source operand of any boolean type and may have any other boolean type as result type. convert The convert operation is used to convert a value in one type to the corresponding value in a different type. For example, converting a 32-bit integer with value 1 into a 32-bit floating-point value should give the floating-point value 1.0. The bit patterns will often be totally different, but the value will be the same (or the closest appropriate value, if applicable). Conversions are allowed between any numeric, enumerated, or pointer type and any other numeric, enumerated, or pointer type. For conversions between integer types where the value is representable in both types, the value must stay the same. Other than that, Standard SUIF does not specify anything about the range of values that are legal for conversion or what the effects of converting various values are. treat_as The treat_as operation takes a source value of any data type at all and returns a result of any other data type at all that has the same bit pattern. That is, it treats the bits as a different type. So applying the treat_as operation to a 32-bit integer with value 1 to get a 32-bit floating-point value is likely not to give the floating-point representation for 1.0. Rather it will give whatever floating-point number is represented by a one in the low-order bit and all other bits zero. Note that using this operation can cause very machine-dependent effects, since it all depends on what bit patterns are used for various types. If the result type is smaller, the high-order bits are dropped. If the result is larger, the high-order bits are filled with zeros.

Next: SelectExpression Up: ExecutionObject Previous: UnaryExpression   Contents
SUIF Nightly Build
2000-08-14