This preview shows page 1. Sign up to view the full content.
Unformatted text preview: signers viewed them as more trouble than they are worth. For example, Java supports only signed integers, and it requires that they be implemented with two’s complement arithmetic. The normal right shift operator >> is guaranteed to perform an arithmetic shift. The special operator >>> is deﬁned to perform a logical right shift. Unsigned values are very useful when we want to think of words as just collections of bits with no numeric interpretation. This occurs, for example, when packing a word with ﬂags describing various Boolean conditions. Addresses are naturally unsigned, so systems programmers ﬁnd unsigned types to be helpful. Unsigned values are also useful when implementing mathematical packages for modular arithmetic and for multiprecision arithmetic, in which numbers are represented by arrays of words. 2.3 Integer Arithmetic
Many beginning programmers are surprised to ﬁnd that adding two positive numbers can yield a negative result, and that the comparison x < y can...
View Full Document