In the former expression we rst sign extend the 16

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: suming a 32-bit machine using two’s complement representation. The nonintuitive cases are marked by ‘*’. Consider the comparison -1 < 0U. Since the second operand is unsigned, the first one is implicitly cast to unsigned, and hence the expression is equivalent to the comparison 4294967295U < 0U (recall that Ì¾Í Û ´ ½µ ÍÅ Ü Û ), which of course is false. The other cases can be understood by similar analyses. 2.2. INTEGER REPRESENTATIONS Expression 0 == 0U -1 < 0 -1 < 0U 2147483647 > -2147483648 2147483647U > -2147483648 2147483647 > (int) 2147483648U -1 > -2 (unsigned) -1 > -2 Type unsigned signed unsigned signed unsigned signed signed unsigned Evaluation 1 1 0* 1 0* 1* 1 0* 49 Figure 2.13: Effects of C Promotion Rules on 32-Bit Machine. Nonintuitive cases marked by ‘*’. When either operand of a comparison is unsigned, the other operand is implicitly cast to unsigned. 2.2.5 Expanding the Bit Representation of a Number One common operation is to convert between integers having different word size...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online