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="Kenneth Brody, post: 2459913"] That "works" is you have 5-bit ints. And 16-bit longs. I don't think ke doesn't want the least-significant bits -- it sounds more like he wants the most-significant bits. (At least, that's what it appears he wants. Maybe. Perhaps.) Or, maybe he's not sure what he wants. How about something like: ( foo >> ( (sizeof(foo) * CHAR_BITS) - 4 ) ) & 0x0f Am I correct that "sizeof(foo)*CHAR_BITS" gives you the number of bits in "foo"? -- +-------------------------+--------------------+-----------------------------+ | Kenneth J. Brody | [URL="http://www.hvcomputer.com"]www.hvcomputer.com[/URL] | | | kenbrody/at\spamcop.net | [URL="http://www.fptech.com"]www.fptech.com[/URL] | #include <std_disclaimer.h> | +-------------------------+--------------------+-----------------------------+ Don't e-mail me at: <mailto:ThisIsASpamTrap@gmail.com> [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C Programming
BITWISE SHIFT QUESTION?
Top