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="Maxim Yegorushkin, post: 2554267"] In C and C++ bits are counted right to left no matter what hardware bit order is. N's bit thus can be extracted by shifting 1 right N times and using the value as a bit-mask: unsigned x; unsigned n; unsigned bit_n = 0 != x & (1 << n); Don't forget that in C and C++ we count from 0, so that the lowest order bit has index 0. [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
C++
BITWISE SHIFT question
Top