40 bit subtraction

Can anyone please give me some hints as to how to go about subtracting one 40 bit number from another?
At the start of a process I read a 5 byte counter from external hardware and store it. At the end of the process I read the 5 byte counter again. I need to find how much the count has incremented by regardless of whether the counter has wrapped or not.
e.g. start 0xFFFFFFFFFE, end 0x0000000001. The answer would be 3.

More questions in this forum