Fix bogus unsigned to signed int conversion.

This leads to failures of computing VIA branches when hash label is higer than 2^31

(cherry picked from commit 2759890fcf41c1af1237206a0f97957cca1f635c)