Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
C++
BITWISE SHIFT question
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="HARDCORECODER, post: 2554357"] lets say I have a 32-bit int. int x =555; I want to extract the first 4 bits. thats bit 0,1,2,3 and place them into another variable. noone wrote this anwser: int bits1to3=(x>>1)&0x0f; // bits 1 2 3 4 or int bits12to15=(x>>12)&0x0f; // bits 12 13 14 15 to extract bit fields you should shift right then use a bit mask containing all ones. I think he is right what do you think? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
BITWISE SHIFT question
Top