fix overflow computation, and use bitmasks instead of modulo calculation

1 file changed