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 Programming
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: 2459790"] ok I want to extract the first 4 bits of a 32 bit interger. The SIZE doesn't really matter. 8,16, 0r 32. I want the first 4 bits.....bit 0,1,2 and,3. I want to exract these and place into another variable. here is my Idea int bits1to3=(x>>1)&0x0f; // bits 1 2 3 4 or long bits1to3=(x>>12)&0x0f; // bits 12 13 14 15 to extract bit field I should shift right then use a bit mask containing all ones. This will store the first 4 bits into bits1to3 right? I beleive this is correct! but anyone else have suggestions? [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
BITWISE SHIFT QUESTION?
Top