Help!!!!

Andreas Kaiser kaiser at ananke.stgt.sub.org
Fri Sep 21 17:26:00 AEST 1990


In a message of <Sep 20 05:24>, hamid misnan (acs17111 at uop.edu ) writes: 
 hm>         Can someone help me in how can I swap bit 2 and 5, I had tried
 hm>         to use bitwise, but I cannot finger it out how it will work.
 hm>         Any help will be appreciated.
 hm>         Thanks in advance.

#define Bit(n) (1 << (n))
i = (i & ~(Bit(2)|Bit(5))) | (i & Bit(5)) >> 5-2 | (i & Bit(2)) << 5-2;

 

--  
:::::::::::::::::::: Internet: kaiser at ananke.stgt.sub.org
:: Andreas Kaiser :: Fidonet:  2:507/18.7206 (+ 2:509/5.2512)
::::::::::::::::::::



More information about the Comp.lang.c mailing list