Div with mul

Replace division by constants with multiplication, additions, shifts.
Use a size specific int instead of unsigned.