Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(337)

Issue 1845123002: Fix C4334 warning about 32-bit shift assigned to 64-bits (Closed)

Created:
4 years, 8 months ago by brucedawson
Modified:
4 years, 8 months ago
Reviewers:
mtklein, reed1
CC:
reviews_skia.org
Base URL:
https://chromium.googlesource.com/skia.git@master
Target Ref:
refs/heads/master
Project:
skia
Visibility:
Public.

Description

Fix C4334 warning about 32-bit shift assigned to 64-bits VS 2015 has a new or louder warning about 32-bit shifts that are then assigned to a 64-bit target. This type of code triggers it: int64_t size = 1 << shift_amount; Because the '1' being shifted is a 32-bit int the result of the shift will be a 32-bit result, so assigning it to a 64-bit variable is just misleading. In this case the code that triggers it is this: size_t alloc = 1<<fLgSize++; The destination is a size_t so the warning only shows up on 64-bit builds and doesn't indicate a real bug. But, casting the '1' constant to size_t makes the behavior/intent more obvious and consistent and allows enabling C4334 in Chromium. BUG=593448 GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1845123002 Committed: https://skia.googlesource.com/skia/+/cce19c821ce0a76886078c6df24fba57fd2f12de

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+1 line, -1 line) Patch
M src/core/SkVarAlloc.cpp View 1 chunk +1 line, -1 line 0 comments Download

Messages

Total messages: 11 (6 generated)
brucedawson
Tiny change to ultimately let me enable C4334 in Chromium gn builds. PTAL.
4 years, 8 months ago (2016-03-31 00:39:33 UTC) #3
reed1
4 years, 8 months ago (2016-03-31 11:00:37 UTC) #5
mtklein
lgtm
4 years, 8 months ago (2016-03-31 12:44:04 UTC) #8
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/patch-status/1845123002/1 View timeline at https://chromium-cq-status.appspot.com/patch-timeline/1845123002/1
4 years, 8 months ago (2016-03-31 12:44:10 UTC) #9
commit-bot: I haz the power
4 years, 8 months ago (2016-03-31 12:53:48 UTC) #11
Message was sent while issue was closed.
Committed patchset #1 (id:1) as
https://skia.googlesource.com/skia/+/cce19c821ce0a76886078c6df24fba57fd2f12de

Powered by Google App Engine
This is Rietveld 408576698