diff options
author | Thomas Van Lenten <thomasvl@google.com> | 2018-01-31 11:59:57 -0500 |
---|---|---|
committer | Thomas Van Lenten <thomasvl@google.com> | 2018-01-31 12:36:54 -0500 |
commit | 953adb16ff2f982d54dd812b51df5fdb392732f8 (patch) | |
tree | f6a855939173eaf8a5a4d6bfc84a87fff8255a0e /objectivec/Tests/GPBUtilitiesTests.m | |
parent | b718551571983f281d065e818da4fd9ca5723d89 (diff) | |
download | protobuf-953adb16ff2f982d54dd812b51df5fdb392732f8.tar.gz protobuf-953adb16ff2f982d54dd812b51df5fdb392732f8.tar.bz2 protobuf-953adb16ff2f982d54dd812b51df5fdb392732f8.zip |
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.m | 8 |
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 { |