摘要 |
The expression 2A+sign(A), where A is a signed binary integer represented in 2's complement form, sign(A) is equal to one when A is greater than zero, sign(A) is equal to zero when A is zero, and sign(A) is equal to negative one when A is less than zero, is calculated by bit-complementing A, bit-complementing (A+A+2) when A is less than zero, bit-complementing (+E,ovs A+EE ++E,ovs A+EE +1) when A is equal to zero, and bit-complementing all bits except a least significant bit of (+E,ovs A+EE ++E,ovs A+EE +1) when A is greater than zero. Zero detect for A is provided by determining whether a first carry-out bit from (+E,ovs A+EE ++E,ovs A+EE +1) and a second carry-out bit from (+E,ovs A+EE ++E,ovs A+EE +2) have different logical values. In this manner, 2A+sign(A) can be calculated by a general purpose computer in a single instruction cycle.
|