Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

3
  • I didn't say n-1 bits set, I said the first n-1 bits(i.e 0 to n-1 th bit) would be set - Remember, the LSB is the 0th bit, so for n=1, first 0 bits (meaning only 0th bit) would be set !! Commented Mar 26, 2011 at 5:33
  • Oops, the above was in response to a comment, looks like he deleted it before I finished !! Commented Mar 26, 2011 at 5:34
  • Possible duplicate of Set last `n` bits in unsigned int Commented Dec 20, 2016 at 19:17