







































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
Representing Information as bits, Bit-Level Manipulations, Integers Representation, unsigned and signed, Conversion, casting, Expanding, Truncating
Typology: Slides
1 / 79
This page cannot be seen from the preview
Don't miss anything!








































































nd
Representa0on: unsigned and signed Conversion, cas0ng Expanding, trunca0ng Addi0on, nega0on, mul0plica0on, shiLing
Binary 00000000 2 to 11111111 2 Decimal: 0 10 to 255 10 Hexadecimal 00 16 to FF 16
Conceptually very large array of bytes Actually implemented with hierarchy of different memory types System provides address space private to par0cular “process”
Where different program objects should be stored All alloca0on within single virtual address space
Address of first byte in word Addresses of successive words differ
32-bit! Words! Bytes! Addr.! 0012 0013 0014 0015 64-bit! Words! Addr! =! ?? Addr! =! ?? Addr! =! ?? Addr! =! ?? Addr! =! ?? Addr! =! ?? 0000 0004 0008 0012 0000 0008
Least significant byte has highest address
Least significant byte has lowest address
Variable x has 4-‐byte representa0on 0x Address given by &x is 0x 0x100 0x101 0x102 0x 01 23 45 67 0x100 0x101 0x102 0x 67 45 23 01 Big Endian! Little Endian!
Address !Instruction Code !Assembly Rendition! 8048365: 5b pop %ebx 8048366: 81 c3 ab 12 00 00 add $0x12ab,%ebx 804836c: 83 bb 28 00 00 00 00 cmpl $0x0,0x28(%ebx)
Text representa0on of binary machine code Generated by program that reads the machine code
Value: 0x12ab Pad to 32 bits: 0x000012ab Split into bytes: 00 00 12 ab Reverse: ab 12 00 00
Decimal:! 15213 Binary: 0011 1011 0110 1101 Hex: 3 B 6 D 6D 3B 00 00 IA32, x86-64! 3B 6D
Sun!
IA32, x86-64! C 93
Sun! Twoʼs complement representation! (Covered later)!
x86-64! 3B 6D
Sun! 6D 3B 00 00
Represented by array of characters Each character encoded in ASCII format
Byte ordering not an issue Linux/Alpha! Sun! 31 38 32 34 33 00
Representa0on: unsigned and signed Conversion, cas0ng Expanding, trunca0ng Addi0on, nega0on, mul0plica0on, shiLing
1937 MIT Master’s Thesis Reason about networks of relay switches
Opera0ons applied bitwise