This preview shows page 1. Sign up to view the full content.
Unformatted text preview: For example, many programmers assume that a program object declared as type int can be used to store a pointer. This works ﬁne for most 32-bit machines but leads to problems on an Alpha. 2.1.4 Addressing and Byte Ordering
For program objects that span multiple bytes, we must establish two conventions: what will be the address of the object, and how will we order the bytes in memory. In virtually all machines, a multibyte object is stored as a contiguous sequence of bytes, with the address of the object given by the smallest address of the 2.1. INFORMATION STORAGE 27 bytes used. For example, suppose a variable x of type int has address 0x100, that is, the value of the address expression &x is 0x100. Then the four bytes of x would be stored in memory locations 0x100, 0x101, 0x102, and 0x103. For ordering the bytes representing an object, there are two common conventions. Consider a Û-bit integer having a bit representation ÜÛ ½ ÜÛ ¾ Ü½ Ü¼ , where ÜÛ ½ is the most signiﬁcant bit, and Ü¼ is the least. Assuming Û is a multiple of eight, these bits c...
View Full Document