aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--include/private/SkFixed.h2
-rw-r--r--tests/MathTest.cpp2
2 files changed, 3 insertions, 1 deletions
diff --git a/include/private/SkFixed.h b/include/private/SkFixed.h
index 640f0e7ea3..be3bb5d604 100644
--- a/include/private/SkFixed.h
+++ b/include/private/SkFixed.h
@@ -78,7 +78,7 @@ typedef int32_t SkFixed;
// The divide may exceed 32 bits. Clamp to a signed 32 bit result.
#define SkFixedDiv(numer, denom) \
- SkToS32(SkTPin<int64_t>((SkLeftShift((int64_t)numer, 16) / denom), SK_MinS32, SK_MaxS32))
+ SkToS32(SkTPin<int64_t>((SkLeftShift((int64_t)(numer), 16) / (denom)), SK_MinS32, SK_MaxS32))
//////////////////////////////////////////////////////////////////////////////////////////////////////
// Now look for ASM overrides for our portable versions (should consider putting this in its own file)
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 23785f742d..1dd8223091 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -530,6 +530,8 @@ DEF_TEST(Math, reporter) {
REPORTER_ASSERT(reporter, result == SK_Fixed1);
result = SkFixedDiv(1, SK_Fixed1);
REPORTER_ASSERT(reporter, result == 1);
+ result = SkFixedDiv(10 - 1, SK_Fixed1 * 3);
+ REPORTER_ASSERT(reporter, result == 3);
}
unittest_fastfloat(reporter);