On Mon, 15 Aug 2011, Pavel Tolkachev wrote:
I needed to write portable and fast C/C++ function to bit-negate the most significant byte of a 32-bit integer. Currently, my target is i386. First, I wrote this function: uint32_t BitNegMsb_1(uint32_t v) { return (v & 0xFFFFFFu) | (~v &0xFF000000u); }
Did you try with a xor? return v^0xFF000000u; -- Marc Glisse