Extract n bits from value

I'm trying to implement an algorithm that demands that I take the last 32 bits from an int. I've read up on the bit-wise operators I wasn't familiar with before, and couldn't find anything. Does anyone know how I could do this?
LOL. You saying that you couldn't find anything about bitwise operators is like saying that you cannot find porn on the Internet. Sorry, but you didn't search.

Also note that an int in C++ is 32 bits wide, so you don't need anything to get the last 32 bits out of an int because it is the entire int.
Sorry, what I meant to say was that I searched for any bit-wise operators that I wasn't familiar with already. I know there's plenty of material on them out there, but I couldn't find any that was new to me.

Also, I should have been clearer in my question, because the algorithm needs several of these extractions, like getting the last 31 bits, or the 32nd bit, and so forth. Basically I need to extract any number of bits from an int.
I see. The 32nd bit is int _32ndbit = intVariable & 0x80000000;, the first 31 bits is int first32bits = intVariable & ~0x80000000;, etc. Use a calculator that shows the bits and can convert from binary to hex, like Windows 7's calculator.
Ah, clever:) That's exactly what I need, thanks you:)
Topic archived. No new replies allowed.