发布时间:2014-06-21 16:59:56
Reversing the bits in an integer x is somewhat painful, but here's a SWAR algorithm for a 32-bit value:unsigned intreverse(register unsigned int x){x = (((x & 0xaaaaaaaa) >> 1) | ((x & 0x55555555) << 1));x = (((x & 0xcccccccc) >> 2) | ((x & 0x33333333) << 2));x = (((x & 0xf0f0f.........【阅读全文】