Minimise object creation without a failure.

For integer types in particular, creating two Long objects every time is expensive.  Doing a long == long is much cheaper and doesn't create garbage unless there is a failure.