This preview shows page 1. Sign up to view the full content.
Unformatted text preview: p; x 0080
x 45ff & ~ 1
x 1234 ^ x 5678
x 1234 & ~ x 5678 | ~ x 1234 & x 5678 Ans wer the following ques tions :
6. W hat are c omputations 1-3 doing? (what does a func tion that c omputes f(x ) = x & 1 do?)
W hat are c omputations 4-6 doing? (hint: s uppos e eac h of the 16 bits bit repres ents a light s witc h that is either on or off)
Continuing with the a light s witc h (or s imilar) analogy , what is c omputation 7 doing?
W hy does c omputation 8 produc e a nonz ero res ult, but c omputation 9 produc es z ero?
W hat is c omputation 10 doing? (what does a func tion that c omputes f(x ) = x & ~ 1 do?)
Compare the res ults of c omputation 11 and 12. Can y ou ex plain? Bit shifting
In this c alc ulator's language, “< < ” means s hift left and “> > ” means s hift right. For ex ample, a < < b s hifts the bits in a left b plac es . In s igned 16-bit mode, run the following c omputations :
12. 4 << 0
View Full Document
This document was uploaded on 03/22/2014.
- Fall '14