Improve variable length integer decoder.
Check preconditions before parsing