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

Unified Diff: src/core/SkFDot6.h

Issue 1503423003: ubsan shift fixes (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: add cast to work around win compiler Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/core/SkEdge.cpp ('k') | src/core/SkFloatBits.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/core/SkFDot6.h
diff --git a/src/core/SkFDot6.h b/src/core/SkFDot6.h
index 3da753da413180de77c162092c4fc98f64d02239..b5367298298cd29f3b85d7577f13e914446e314e 100644
--- a/src/core/SkFDot6.h
+++ b/src/core/SkFDot6.h
@@ -56,9 +56,9 @@ inline SkFDot6 SkScalarRoundToFDot6(SkScalar x, int shift = 0)
#define SkFixedToFDot6(x) ((x) >> 10)
inline SkFixed SkFDot6ToFixed(SkFDot6 x) {
- SkASSERT((x << 10 >> 10) == x);
+ SkASSERT((SkLeftShift(x, 10) >> 10) == x);
- return x << 10;
+ return SkLeftShift(x, 10);
}
#define SkScalarToFDot6(x) (SkFDot6)((x) * 64)
@@ -68,7 +68,7 @@ inline SkFixed SkFDot6Div(SkFDot6 a, SkFDot6 b) {
SkASSERT(b != 0);
if (a == (int16_t)a) {
- return (a << 16) / b;
+ return SkLeftShift(a, 16) / b;
} else {
return SkFixedDiv(a, b);
}
« no previous file with comments | « src/core/SkEdge.cpp ('k') | src/core/SkFloatBits.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698