Bug 4517 error: comparison between signed and unsigned integer
The old cast is required when size_t is unsigned (as it should be).
The new cast is required when size_t is signed (as it may be).
We could cast just the left-hand side to be signed instead, but it feels
slightly wrong to do that here because all values we are casting are
meant to be unsigned and, hence, in theory, might overflow in some
future version of the code if we cast them to a signed value now and
forget to fix that cast later while adding support for larger values.