Unformatted text preview: oth encode the numeric value 12,345, they have very different byte patterns: 0x00003039 for the integer, and 0x4640E400 for ﬂoating point. In general, these two formats use different encoding schemes. If we expand these hexadecimal patterns into binary and shift them appropriately, we ﬁnd a sequence of 13 matching bits, indicated below by a sequence of asterisks:
0 0 0 0 3 0 3 9 00000000000000000011000000111001 ************* 4 6 4 0 E 4 0 0 01000110010000001110010000000000 This is not coincidental. We will return to this example when we study ﬂoating-point formats. Practice Problem 2.2:
Consider the following 3 calls to show_bytes: int val = 0x12345678; byte_pointer valp = (byte_pointer) &val; show_bytes(valp, 1); /* A. */ show_bytes(valp, 2); /* B. */ show_bytes(valp, 3); /* C. */ Indicate below the values that would be printed by each call on a little-endian machine and on a bigendian machine. A. Little endian: B. Little endian: C. Little endian: Big endian: Big endian: Big endian: Practice Prob...
View Full Document