Avoid undefined behavior by using unsigned int instead of int.

* 1 << 31, 2 << 30, 3 << 30 replaced by 1U << 31, 2U << 30 or 3U << 30.