By Daniel · January 4, 2009
Returns a modified version of n with some specified bit set to val. bit=0 indicates the least significant bit (worth 1, usually written on the far right), bit=1 indicates the next (worth 2), and so forth; in general terms, bit=p refers to the bit worth 2^p.
See also: get_bit
/* set_bit(n, bit, val) * * Returns a modified version of n with some specified bit set to val. bit=0 * indicates the least significant bit (worth 1, usually written on the far * right), bit=1 indicates the next (worth 2), and so forth; in general terms, * bit=p refers to the bit worth 2^p. */ if (argument2) return argument0 | (1 << argument1); else return argument0 & (~0 - (1 << argument1));
Categories: Data processing, Mathematics
There are no comments to display.
You must be signed in to post comments.