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 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 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 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.comalgogeeks%2bunsubscr...@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- Hide quoted text -
 
  - Show quoted text -

 --
 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.comalgogeeks%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.



[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$ dixit.coolfrog.div...@gmail.com
wrote:
 @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 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 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 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.comalgogeeks%2bunsubscr...@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- Hide quoted text -

   - Show quoted text -

  --
  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.comalgogeeks%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- Hide quoted text -

 - Show quoted text -

-- 
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.



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 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.comalgogeeks%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.



[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 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 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.comalgogeeks%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- Hide quoted text -

 - Show quoted text -

-- 
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.



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. -- Dave

 On Nov 21, 8:21 am, coolfrog$ dixit.coolfrog.div...@gmail.com
 wrote:
  @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 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.comalgogeeks%2bunsubscr...@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- Hide quoted text -
 
  - Show quoted text -

 --
  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.comalgogeeks%2bunsubscr...@googlegroups.com
 .
 For more options, visit this group at
 http://groups.google.com/group/algogeeks?hl=en.




-- 
DIPANKAR DUTTA
M-TECH,Computer Science  Engg.
EC Dept,IIT ROORKEE
Uttarakhand , India – 247667
---
website:http://people.iitr.ernet.in/shp/09535009/Website/index.html
ph no-09045809987
email:dipan...@iitr.ernet.in email%3adipan...@iitr.ernet.in

-- 
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.



[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 )

 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.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.



[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  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.
For more options, visit this group at 
http://groups.google.com/group/algogeeks?hl=en.