If you can be sure that your sampling rate is much higher than your highest rate of rotation (so you have at least two samples per rotation) you can simply check for overflows. Is the new position < the previous position? If so you had an overflow, and a full rotation was completed. At 50 sps that means your rpm should always be < 25 * 60 = 1500 rpm.
In code, it'd look like this:
unsigned int revolutionCount = 0;
unsigned int oldPosition;
unsigned int takeSample() {
unsigned int currentPosition = readEncoder();
if (currentPosition < oldPosition) revolutionCount++;
oldPostion = currentPosition;
return currentPosition;
}