Professional Documents
Culture Documents
Lecture 9
Lecture 9
Puru
with
CS101 TAs and Staff
0 0 0 1 1 1 0 0 0 0
0 0 1 0 0 0 1 1 0 0
0 1 0 0 0 0 0 0 1 0
1 0 0 0 0 0 0 0 1 0
1 0 1 0 0 0 1 0 0 1
1 0 0 0 0 0 0 0 0 1
1 0 0 1 1 1 0 0 1 0
0 1 0 0 0 0 0 0 1 0
0 0 1 0 0 0 1 1 0 0
0 0 0 1 1 1 0 0 0 0
26
0xf
255
16
0xffff
26 1a (0x1a) 10110
15 0xf 1111
16 0x10 00010000
8-4
4-8
02/08/19 Autumn 2019 CS101@CSE IIT Bombay 11
The bool type
10110110 10110110
10010101 10010101
& ^
10010100 00100011
10110110 00100011
10010101 ~
| 11011100
10110111
02/08/19 Autumn 2019 CS101@CSE IIT Bombay 14
Left shift operator
00000000,00000000,00000000,00000101
00000000,00000000,00000000,00010100
• outputs of …
int a = 1;
cout << a;
a = a << 31;
cout << a;
a = a >> 31;
cout << a;
– 1000001
– 1.000001 x 2110
– binary point moved 6 places to the right
– 6 is 110 in binary
• 3.75 as float
• 0.75
• 3450
– 1.10101111010 x 21011
1 1 0 1 0 1 1 1 1 0 1 0
10010
11101000
10010
11101000
• i386
• x86_64
• PowerPC
Autumn 2019 CS101@CSE IIT Bombay
Example
57 100 200 300
Read Write
Memory
1 0
Read Write
Memory
1 0
Read Write
Read Write
Memory
0 1
Instruction
execution is
Read Write COMPLETE
Autumn 2019 CS101@CSE IIT Bombay