# 3 - Representation and Manipulation Information(2 1 Outline...

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

1 Representation and Manipulation Information (2)

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

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

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

View Full Document
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
5 General Boolean Algebras Operate on Bit Vectors Operations applied bitwise 01101001 01000001 01101001 | 01010101 01111101 01101001 ^ 01010101 00111100 ~ 01010101 10101010

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

View Full Document
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 }
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

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

View Full Document
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
Logical Operations in C Logical Operators || ! View 0 as “False”

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 10/19/2011 for the course CS 000 taught by Professor Jing during the Fall '10 term at Fudan University.

### Page1 / 34

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

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

View Full Document
Ask a homework question - tutors are online