Fixed undefined signed overflow

Put values in uint64 temporaries to do arithmetic.

Change-Id: I6d6886a0543972f09ca2546c537eac8329127e18
Merge topic 'sanitize-signed-integer-overflow' into master

d232c8d5 Fixed undefined signed overflow