invert function in c

Write a function invert(x,p,n) that returns x with the n bits that begin at position p inverted (i.e., 1 changed into 0 and vice versa), leaving the others unchanged.


  1. x = ((2^n-1)<<p)^x

    i am too lazy to explain this now :) !!


Post a Comment

Popular posts from this blog