Re: [algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-22 Thread coolfrog$
@dave plz run gene's code for input 0xAD...or send me some link of bitwise programing which involve simultaneous many opearation... like above... i am always confused with bitwise programing... On Sun, Nov 21, 2010 at 11:11 PM, Dave dave_and_da...@juno.com wrote: @Coolfrog$: Don't forget the

[algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-22 Thread Dave
@Coolfrog$: It will be instructive if you do it for yourself. Perhaps with practice you can work through your confusion. Have you worked out the bit patterns of those hex constants? They are crucial to understanding Gene's algorithm. -- Dave On Nov 22, 6:55 am, coolfrog$

Re: [algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-21 Thread coolfrog$
@gene plz explain .. what is going on... by taking example. i am unable to run a test case 1. x=0xAD (1010 1101) 2. x1 ===01011010 | x1 01010110 x =0100 how we will get answer as ( 0101 1011).?? On Sun, Nov 21, 2010 at 9:59 AM, Gene

[algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-21 Thread Dave
@Coolfrog$: Don't forget the bitwise logical products. What is the bit patterns in those hexadecimal constants? Work out the whole example and you will see how it works. -- Dave On Nov 21, 8:21 am, coolfrog$ dixit.coolfrog.div...@gmail.com wrote: @gene plz explain .. what is going on... by

Re: [algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-21 Thread DIPANKAR DUTTA
x=((x3)(0x11)|(a3) 0x88 |(a1) 0x44 | (a1) 0x22) On Sun, Nov 21, 2010 at 11:11 PM, Dave dave_and_da...@juno.com wrote: @Coolfrog$: Don't forget the bitwise logical products. What is the bit patterns in those hexadecimal constants? Work out the whole example and you will see how it works. --

[algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-20 Thread Gene
In C, unsigned char x; ... x = (x 1) | (x 1); x = (x 2) | (x 2); 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 )

[algogeeks] Re: Swap the LSB and MSB within themself of given no.

2010-11-20 Thread Gene
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