How do I get the lower 12 bits of a 32 bit int?
How do I get the lower 12 bits of a 32 bit int?
It probably depends on how you want it. Perhaps you could use:
Code:std::bitset<12> bits(num);
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
abachler, why use your solution when brewbuck's suggestion works fine (assuming Yarin wants the bits in that way) and is more portable?
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
>> assuming Yarin wants the bits in that way
Here is why I'm trying to get the 16 bits.
So will 0xFFF work fine in doing that job?The channel handle :
The return value is reference counted. This stops the user from updating a stolen channel.
Basically it means the only sound you can change the attributes (ie volume/pan/frequency/3d position) for are the one you specifically called playsound for. If another sound steals that channel, and you keep trying to change its attributes (ie volume/pan/frequency/3d position), it will do nothing.
This is great if you have sounds being updated from tasks and you just forget about it.
You can keep updating the sound attributes and if another task steals that channel, your original task wont change the attributes of the new sound!!!
The lower 12 bits contain the channel number. (yes this means a 4096 channel limit for FMOD
The upper 19 bits contain the reference count.
The top 1 bit is the sign bit.
ie
S RRRRRRRRRRRRRRRRRRR CCCCCCCCCCCC
If you want to extract a certain number of bits from a string, then the general method is this:
Open your calculator, switch to binary mode, enter n 1 then convert to decimal or hexdecimal.
Then simply do a binary AND with the mask on the original number and you have extracted n bits.
(Binary 1111 1111 1111 is hex 0xFFF)