Re:Demystifying bitwise operations, a gentle C tutorial
by ziml77 on Friday March 03, 2023 @08:30PM
(#35017218)
I've done the >> 0 thing to make it very clear what's going on, but I hadn't considered the * 8 construction. That's actually easier to comprehend at a glance because the numbers become less "magic". (8 and 16 are obvious to me, but 24 always has me second-guessing myself somewhere in the back of my mind)
[ Parent
| on HN ]
Re:Demystifying bitwise operations, a gentle C tutorial
by lolcatuser on Saturday March 04, 2023 @01:19PM
(#35023049)
I use octal for this.
x << (3 * 8);
vs. x << 030;