Oops. && should be & and || should be |
int r;
r = ( ( x & 0xffff0000 ) >> 16 ) | ( ( x & 0x0000ffff ) << 16 );
r = ( ( r & 0xff00ff00 ) >> 8 ) | ( ( r & 0x00ff00ff ) << 8 );
r = ( ( r & 0xf0f0f0f0 ) >> 4 ) | ( ( r & 0x0f0f0f0f ) << 4 );
r = ( ( r & 0xcccccccc ) >> 2 ) | ( ( r & 0x33333333 ) << 2 );
r = ( ( r & 0xaaaaaaaa ) >> 1 ) | ( ( r & 0x55555555 ) << 1 );
return r;
Dave
On Sep 3, 2:00 pm, albert theboss <[email protected]> wrote:
> @Dave but i tried the code its not working ....
>
> Its giving 1 for all the input
>
> could u explain the code please ....
--
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.