Add year range speedup

This speeds up our calculations involving counting the days over a
number of consecutive years. This is especially true of large
prehistoric or futuristic dates.

It's arguable that the new function should not be inclusive of the
end year, in a similar way to the Python range function.

@matthewrmshin, please review.
Need to document this carefully for API purpose, especially for the behaviour of `start_year > end_year`.