Hi All,
I have an unsigned int that I use to keep track of the frame I am in. Through out my code I need to know the difference between the current frame I am in and other frames that happened in the past.
If the current frame was 5000 and the frame I am checking against is 4900, then that computation is easy (5000 - 4900 = 100 difference). The problem is when the frame reaches the limit of unsigned ints and loops back to 0, then I need to calculate the difference as follows. Lets say the current frame is 10, and the past frame is 4000. I cannot use 10 - 4000, because the difference is incorrect, so I have to use 10 - 4000 + UINT_MAX.
I was wondering if anyone had any ideas how to do this in one single formula without having to check if there was a loop around (or had any other ideas)?

