This preview shows page 1. Sign up to view the full content.
Unformatted text preview: *a as a<<1 + a. What multiples of a can be computed with this instruction? Ü¼ , 2.3.7 Dividing by Powers of Two
Integer division on most machines is even slower than integer multiplication—requiring 30 or more clock cycles. Dividing by a power of two can also be performed using shift operations, but we use a right shift rather than a left shift. The two different shifts—logical and arithmetic—serves this purpose for unsigned and two’s complement numbers, respectively. Integer division always rounds toward zero. For Ü ¼ and Ý ¼, the result should be Ü Ý , where for any ¼ · ½. As examples ¿ ½ real number , is deﬁned to be the unique integer ¼ such that ¼ ¿, ¿ ½ , and ¿ ¿. Consider the effect of performing a logical right shift on an unsigned number. Let Ü be the unsigned integer represented by bit pattern ÜÛ ½ ÜÛ ¾ Ü¼ , and be in the range ¼ Û. Let Ü¼ be the ¼¼ be the unsigned number with unsigned number with Û -bit representation ÜÛ ½ ÜÛ ¾ Ü , and Ü -...
View Full Document
- Spring '10
- The American