oops so sleek and simple :)
Mohit Ranjan On Mon, Jun 21, 2010 at 10:11 PM, Dave <[email protected]> wrote: > Not hard at all: > > y = ((x & 0xAA) >> 1) | ((x & 0x55) << 1) > > Dave > > On Jun 21, 7:07 am, amit <[email protected]> wrote: > > Given a byte, write a code to swap every two bits. [Using bit > > operators] Eg: Input: 10 01 11 01 Output: 01 10 11 10 > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]<algogeeks%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.
