Wouldn’t making that const or using #define be a bit cleaner?
Honestly if I as the programmer knew that I was really trying to select bits from a number I’d just use a binary and directly. In that specific situation I think the intent is more clear that way. Like:
Comments
Wouldn’t making that const or using #define be a bit cleaner?
Honestly if I as the programmer knew that I was really trying to select bits from a number I’d just use a binary and directly. In that specific situation I think the intent is more clear that way. Like:
//select the bottom 8 bits
unsigned bottom8 = val & 0xff;