Add comments and assertions to make it clearer how BTFindResRange and BTFindResRangeHigh work. In particular, explain why the possible unsigned integer underflow in BTFindResRangeHigh is safe.