this is from K&R exercise :) Best Regards Ashish Goel "Think positive and find fuel in failure" +919985813081 +919966006652
On Wed, Sep 12, 2012 at 4:14 PM, Navin Gupta <[email protected]> wrote: > int temp = {[1<<(j-+1)]<<i-1}; > Here temp is a number with all the bits set between positions i & j > [both inclusive] > temp = ~temp; > N = N & temp; // here we are clearing all the bits of N from > position i to j > temp = temp | M; // now we are taking the bit pattern from M into > temp in the given positions > N = N | temp; // now again we are setting the same pattern from > temp into N. > > Note :- clearing bit means bit set to zero , while setting bit means bit > is 1 > > > -- > You received this message because you are subscribed to the Google Groups > "Algorithm Geeks" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/algogeeks/-/QTXreMoSy6gJ. > > 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. > -- 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.
