Decimal ia32 c 39 30 00 00 0 3 9 x8664 c sun

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: Washington Byte Ordering     How should bytes within mulJ ­byte word be ordered in memory? Say you want to store 0xaabbccdd   What order will the bytes be stored? Memory 23 University of Washington Byte Ordering     How should bytes within mulJ ­byte word be ordered in memory? Say you want to store 0xaabbccdd   What order will the bytes be stored?   Endianness: big endian vs. lille endian   Two different convenGons, used by different architectures   Origin: Gulliver’s Travels (see CS:APP2 textbook, secGon 2.1) Memory 24 University of Washington Byte Ordering Example   Big ­Endian (PowerPC, Sun, Internet)   Least significant byte has highest address   Lille ­Endian (x86)   Least significant byte has lowest address   Example   Variable has 4 ­byte representaGon 0x01234567   Address of variable is 0x100 0x100 Big Endian 0x102 0x103 01 23 45 67 0x100 Lille Endian 0x101 0x101 0x102 0x103 67 45 23 01 Memory 25 University of Washington RepresenJng Integers       int A = 12345; int B = -12345; long int C = 12345; IA32, x86 ­64 A Sun A 39 30 00 00 00 00 30 39 IA32, x86 ­64 B FF FF CF C7 Binary: 0011 0000 0011 1001 3 Hex: Sun B C7 CF FF FF 12345! Decimal:! IA32 C 39 30 00 00 0 3 9 X86 ­64 C Sun C 39 30 00 00 00 00 00 00 00 00 30 39 Two’s complement representaJon for negaJve integers (covered later) Memory 26 University of Washington Memory, Data, and Addressing           Preliminaries RepresenJng informaJon as bits and bytes Organizing and addressing data in memory ManipulaJng data in memory using C Boolean algebra and bit ­level manipulaJons Memory 27 University of Washington Addresses and Pointers in C   & = ‘address of value’ * = ‘value at address’...
View Full Document

Ask a homework question - tutors are online