Use a signed int when we check for <0

    If we use negative value to signal errors, we had better make
    sure that we can hold negative values.
Merge branch 'master' of git+ssh://mimir.eigenstate.org/git/ori/mc