runtime: fix integer overflow
The problem happens when end=0, then end-1 is very big number.
Observed with the new scheduler.

R=golang-dev, iant
CC=golang-dev
https://codereview.appspot.com/7307073