标签:
Write a program to swap odd and even bits in an integer with as few instructions as possible.
public static int swapOddEvenBits(int x) { return ( (( x & 0xaaaaaaaa) >> 1 | (x & 0x55555555) << 1) ); }
标签:
原文地址:http://blog.csdn.net/xiaogaokuaixiazai/article/details/44260769