Topic: DMD0537 Math Bit-wise Invert Operator |
|||||||||||||||||||||
|
|||||||||||||||||||||
The Math Bit-wise Invert operator ( ~ ) performs the ones' complement of the given binary value meaning that bits that are 0 become 1, and bits that are 1 become 0.
Note: bit-wise Invert operations are typically only used for unsigned hexadecimal values and unsigned integer memory locations. Using the :U cast operator on signed 16-bit values will cause them to be processed as unsigned 16-bit values. There is no unsigned cast operation for 32-bit signed values.
The operand can be any mix of signed integers, unsigned integers, real (floating point) numbers or discrete values. They can be any numeric or discrete memory location, or any numeric or discrete structure member.
All discrete values and all 16-bit integer values are promoted to 32-bit 2's complement signed integer values. If a Real value is included in the equation then all of the values will be promoted to Real values and all calculations will be performed using Real numbers.
Traditional math precedence rules are used to solve the math expression, The use of parentheses to remove any ambiguity in the processing order is encouraged.
As stated earlier, bit-wise operations are intended for use on Unsigned integer values, NOT Signed integer values or Real values. The following examples are here only to provide understanding in how these values will be processed by the math stack, the result that is generated is typically not useful.
|
|||||||||||||||||||||
|
|||||||||||||||||||||
See Also:
Bit-wise Invert
|
|||||||||||||||||||||
|
|||||||||||||||||||||
Related Topics:
|
|||||||||||||||||||||
|