Add casts to removed undefined behaviors around shifts.

Fixes #4246
Fixes #4247
diff --git a/objectivec/GPBUtilities.m b/objectivec/GPBUtilities.m
index 77ea957..2574656 100644
--- a/objectivec/GPBUtilities.m
+++ b/objectivec/GPBUtilities.m
@@ -291,7 +291,7 @@
   } else {
     NSCAssert(idx != GPBNoHasBit, @"Invalid has bit.");
     uint32_t byteIndex = idx / 32;
-    uint32_t bitMask = (1 << (idx % 32));
+    uint32_t bitMask = (1U << (idx % 32));
     BOOL hasIvar =
         (self->messageStorage_->_has_storage_[byteIndex] & bitMask) ? YES : NO;
     return hasIvar;
@@ -315,7 +315,7 @@
     NSCAssert(idx != GPBNoHasBit, @"Invalid has bit.");
     uint32_t *has_storage = self->messageStorage_->_has_storage_;
     uint32_t byte = idx / 32;
-    uint32_t bitMask = (1 << (idx % 32));
+    uint32_t bitMask = (1U << (idx % 32));
     if (value) {
       has_storage[byte] |= bitMask;
     } else {