Masking bits within a range given in parameter in C
问题 I am new to C programming and not sure that there is already a good explanation for how to do this, if so I am sorry. I am trying to set the bits within a range given to me. the function signature looks like: unsigned int setBits(int low, int high, unsigned int source) { source being the number to be operated on, low being the lowest bit in the range, and high being the highest bit in the range. I understand bit-shifting just fine when trying to get specifically the last 4 bits or first 4 or