@gene plz explain .. what is going on... by taking example..... i am unable to run a test case 1. x=0xAD (1010 1101) 2. x<<1 ===>01011010 | x>>1 ====>01010110 x = 01011110 how we will get answer as ( 0101 1011).....??????
On Sun, Nov 21, 2010 at 9:59 AM, Gene <gene.ress...@gmail.com> wrote: > if the input is in unsigned char x, then > > x = ((x << 1) & 0xAA) | ((x >> 1) & 0x55) > x = ((x << 2) & 0xCC) | ((x >> 2) & 0x33) > > On Nov 20, 10:41 pm, Divesh Dixit <dixit.coolfrog.div...@gmail.com> > wrote: > > assuming all are 8bit no. > > input = 0x46 (0100 0110) > > output = 0x26 ( 0010 0110 ) > > input = 0x75 (0111 0101) > > output = 0xFC (1110 1010 ) > > > > Algorithm..??? > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To post to this group, send email to algoge...@googlegroups.com. > To unsubscribe from this group, send email to > algogeeks+unsubscr...@googlegroups.com<algogeeks%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/algogeeks?hl=en. > > -- *Divesh* (¨`·.·´¨) Always `·.¸(¨`·.·´¨ ) Keep (¨`·.·´¨)¸.·´Smiling! `·.¸.·´" Life can give u 100's of reason 2cry,but u can give life 1000's of reasons 2Smile" -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To post to this group, send email to algoge...@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.