Lets say i have array unsigned long X[4]; Now, i want to shift right bits in the array by 5. that is the lowest 5 bits of element N will become the highest 5 bits of element N-1. the lowest 5 bits of 0th element are lost. what is the best way to do this? My C reference book does not go in detail on preserving the bits which are lost during bitshifts. X[3]=X[3]>>5; but what is X[2] in this case? Also is there a way to determine the count of the most significant non-zero bit in a variable? for example in the case 0010010101010010 answer would be 14. This can be done by repeatedly testing the variable storing above value against 2^N untill 2^N is greater than X. The count of most significant bit would be N-1, assuming the right ost bit is in 0th position, but is there a more efficient way to do this? In both cases timing is critical. Thanks ahead.