3 - Representation and Manipulation Information (2) 1...

Info iconThis preview shows pages 1–10. Sign up to view the full content.

View Full Document Right Arrow Icon
1 Representation and Manipulation Information (2)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 Outline Bit-level operations Suggested reading 2.1.7~2.1.10
Background image of page 2
3 Boolean Algebra Developed by George Boole in 19th Century Algebraic representation of logic Encode “True” as 1  Encode “False” as 0
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 Boolean Algebra And Not ~A = 1 when A=0 Or A|B = 1 when either A=1 or B=1 Exclusive-Or (Xor) A^B = 1 when either A=1 or B=1, but not both
Background image of page 4
5 General Boolean Algebras Operate on Bit Vectors Operations applied bitwise 01101001 01000001 01101001 | 01010101 01111101 01101001 ^ 01010101 00111100 ~ 01010101 10101010
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
6 General Boolean Algebras Representation of Sets Width w bit vector represents subsets of {0, …, w–1} – a j  = 1 if j    A 01101001 { 0, 3, 5, 6 } 01010101 { 0, 2, 4, 6 } 01000001 { 0, 6 } |  Union 01111101  { 0, 2, 3, 4, 5, 6 } ^ Symmetric difference   00111100 { 2, 3, 4, 5 } ~Complement    10101010 { 1, 3, 5, 7 }
Background image of page 6
7 Bit-Level Operations in C Apply to any “integral” data type long,  int,  short,  char View arguments as bit vectors Arguments applied bit-wise
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
8 Bit-Level Operations in C ~0x41 0xBE ~0x00 0xFF 0X41 0x69 | 0x55 0x7D ~0100 0001 1011 1110 ~0000 0000 1111 1111 0110 1001 | 0101 0101 0111 1101
Background image of page 8
Logical Operations in C Logical Operators || ! View 0 as “False”
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 10
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 34

3 - Representation and Manipulation Information (2) 1...

This preview shows document pages 1 - 10. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online