News for hackers. Stuff that matters.
Re:A Bit Overcomplicated by flerchin on Thursday August 05, 2021 @11:20AM (#28074967)
It's super common for embedded devices, and kernel development. Yeah compilers can mostly figure it out, but if you're really looking at the bits of a value, like in the example, you should operate on them bitwise, it's more clear, and definitely leaves no room for the compiler to leave it in an inefficient state.
Re:A Bit Overcomplicated by sudhirj on Thursday August 05, 2021 @11:45AM (#28075341)
Yeah, I'm a little embarrassed to say I'd have used an array do what's in the example. I wouldn't have done all the unnecessary string conversions, but if I have a sequence of 64 things and I want the first 22 things that's a slice operation in my head, not a bit-shift, even if the things are bits.