Timeline for How do you set, clear, and toggle a single bit?
Current License: CC BY-SA 4.0
2 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 7, 2021 at 21:16 | comment | added | Will Eccles |
This could be much more succinctly (and likely more efficiently, unless the compiler optimizes your solution) as (number & ~(1 << n)) | (!!x << n) .
|
|
Feb 6, 2021 at 9:43 | history | answered | Dominic van der Zypen | CC BY-SA 4.0 |