aboutsummaryrefslogtreecommitdiffhomepage
path: root/objectivec/Tests/GPBUtilitiesTests.m
diff options
context:
space:
mode:
authorGravatar Thomas Van Lenten <thomasvl@google.com>2018-01-31 11:59:57 -0500
committerGravatar Thomas Van Lenten <thomasvl@google.com>2018-01-31 12:36:54 -0500
commit953adb16ff2f982d54dd812b51df5fdb392732f8 (patch)
treef6a855939173eaf8a5a4d6bfc84a87fff8255a0e /objectivec/Tests/GPBUtilitiesTests.m
parentb718551571983f281d065e818da4fd9ca5723d89 (diff)
Add casts to removed undefined behaviors around shifts.
Fixes #4246 Fixes #4247
Diffstat (limited to 'objectivec/Tests/GPBUtilitiesTests.m')
-rw-r--r--objectivec/Tests/GPBUtilitiesTests.m8
1 files changed, 4 insertions, 4 deletions
diff --git a/objectivec/Tests/GPBUtilitiesTests.m b/objectivec/Tests/GPBUtilitiesTests.m
index 2e206a54..8a8ba93e 100644
--- a/objectivec/Tests/GPBUtilitiesTests.m
+++ b/objectivec/Tests/GPBUtilitiesTests.m
@@ -52,12 +52,12 @@
- (void)testRightShiftFunctions {
XCTAssertEqual((1UL << 31) >> 31, 1UL);
- XCTAssertEqual((1 << 31) >> 31, -1);
+ XCTAssertEqual((int32_t)(1U << 31) >> 31, -1);
XCTAssertEqual((1ULL << 63) >> 63, 1ULL);
- XCTAssertEqual((1LL << 63) >> 63, -1LL);
+ XCTAssertEqual((int64_t)(1ULL << 63) >> 63, -1LL);
- XCTAssertEqual(GPBLogicalRightShift32((1 << 31), 31), 1);
- XCTAssertEqual(GPBLogicalRightShift64((1LL << 63), 63), 1LL);
+ XCTAssertEqual(GPBLogicalRightShift32((1U << 31), 31), 1);
+ XCTAssertEqual(GPBLogicalRightShift64((1ULL << 63), 63), 1LL);
}
- (void)testGPBDecodeTextFormatName {