2006-05-24

Bit-fiddling in C

long bit_set( long S, int n)
{return(S|(1<<n));}

long bit_clear( long S, int n)
{return(S&~(1<<n));}

int bit_in( long S, int n)
{return((S&(1<<n))!=0);}