To set the n-th bit:
To clear the n-th bit:
To toggle the n-th bit:
To check if n-th bit is set:
To set the n-th bit to x
in two’s complement:
To set the n-th bit to x
(regardless of representation):
Alternatively use a bitset
.
To set the n-th bit:
To clear the n-th bit:
To toggle the n-th bit:
To check if n-th bit is set:
To set the n-th bit to x
in two’s complement:
To set the n-th bit to x
(regardless of representation):
Alternatively use a bitset
.