interview #4

Dec 14, 2007 09:43

happydays

This interview thing is getting easier... I still think I'd be nervous as heck going in to a non-RIM interview in that "suits wtf" and weird questions I'd anticipate and such. BUT regardless.

I did something with bitwise operations today for the first time (excluding variable switching and XOR):
>taking an unsigned 32-bit integer, reverse the order of the bytes:
[first let me explain my lazy-notation:
(8) := a byte of a combination of 1's and 0's
(8 1's) := a byte of all ones (i.e., 0xFF :p)
(8 0's) := a byte of all zeros (i.e., 0X00)
//so why don't I just write in hex? well, because that's not how I did it in the interview; they told me that part after :p//]

x = (8)(8)(8)(8)

firstByte = (x & (8 1's)(8 0's)(8 0's)(8 0's)) >> 24
secondByte = (x & (8 1's)(8 0's)(8 0's)) >> 8
thirdByte = (x & (8 1's)(8 0's)) << 8
fourthByte = (x & (8 1's)) << 24

x = firstByte & secondByte & thirdByte & fourthByte

heehee!

Now, for my wonderful breakfast of Miss Vickie's Roasted Red Pepper Grill chips!

~~Geane

food, code, interview, bitwise operations

Previous post Next post
Up