Given a unsigned int x, I want to set the nth bit to y, and y can be either 0 or 1. Is it possible to create an expression using bitwise operators to do this while avoiding the use of any conditional statements? Thanks.
|
Quite simple. (First, clear the |
|||||||||||||
|
|
|||||||||||||
|