Java Reference
In-Depth Information
In most computers the smallest unit of individually addressable stor-
age is 8 bits (one byte). Individual bits are not directly addressable and
must be manipulated as part of larger units of data storage.
The machine's word size determines the units of data storage, the ma-
chine instruction size, and the units of memory addressing. PCs equipped
with the Intel 8086, 8088, or 80286 CPU have 16-bit wide registers, trans-
fer data in 8 and 16-bit units to memory and ports, and address memory
usinga16-bitbase(segmentregister)and16-bitpointers(offsetregister).
Since the data registers in these CPUs are 16-bits wide, the largest value
that can be held in a register is 11111111 11111111 binary, or 65,535 deci-
mal. PCs that use the Intel 80386, 486, and Pentium CPU have 32-bit inter-
nal registers and a flat address space that is 32-bits wide. In these
machines the word size is 32 bits. For compatibility reasons some operat-
ing systems and application code use the 80386, 486, and Pentium micro-
processors in a mode compatible with their 16-bit predecessors.
Representing Integers
The integers are the set of whole numbers, which can be positive or nega-
tive.Integerdigitsarelocatedonestorageunitapartanddonothaveadeci-
malpoint.Thecomputerstorageofunsignedintegersisastraightforward
binaryencoding.SincethesmallestaddressableunitofstorageinthePCis
one byte, the CPU logic pads with leading zeros numbers that are smaller
thanonebyte. Figure2.1 isarepresentationofanintegernumberstored
electronically in a computer cell.
machine storage
binary
decimal
= 01010010 10010101 = 21,141
Figure 20-1 Representation of an Unsigned Integer
Sign-magnitude integers
Representingsignednumbersrequiresaspecialconventioninordertodif-
ferentiatepositivefromnegativemagnitudes.Themostgenerallyaccepted
schemeistodevoteonebittorepresentthesign.Acommonsignednumber
storageformatsetsthehigh-orderbittoindicatenegativemagnitudesand
clearsittoindicatepositivemagnitudesandzero.Inthisschemethedeci-
mal numbers 93 and -93 are represented as follows:
 
Search WWH ::




Custom Search