I think this might be better for c/c++ though admittedly a bit more cryptic: (x>>1) + (y>>1) + (0x01 & x & y)
That gets really dicey if you're storing the value of the index in a variable. Does the programmer need to know that if it's an INDEX they're storing that goes from 1-256 they can fit that into an 8-bit value because…
Let me put it to you this way. Everyone knows that salicylic acid (originally derived from willow bark) is a precursor to aspirin that is effective as a pain killer, fever reducer, and anti-inflammatory.…
I think this might be better for c/c++ though admittedly a bit more cryptic: (x>>1) + (y>>1) + (0x01 & x & y)
That gets really dicey if you're storing the value of the index in a variable. Does the programmer need to know that if it's an INDEX they're storing that goes from 1-256 they can fit that into an 8-bit value because…
Let me put it to you this way. Everyone knows that salicylic acid (originally derived from willow bark) is a precursor to aspirin that is effective as a pain killer, fever reducer, and anti-inflammatory.…