Convert magic values to constants

Make it clear what `-1` and `0` represent by replacing these values with
constants.

Export these constants publicly so that we can re-use them in our tests
(I'd like to find a better way to do that).