Fix issue 11576.

This bug is caused by careless code when dealing with unsigned quantities.