This reduces the risk for overflow in pathlogical cases. Signed-off-by: Martin Storsjö <martin@martin.st>