Make SkFixedRound/Ceil/FloorToFixed as inline func
The macros that we were using will return unsigned int32 instead of
signed int32 because of the last 0xFFFF0000 mask. That may bring
problems if we right shift that result.
Special thanks to mtklein@google.com for helping me find out this issue.
BUG=skia:
GOLD_TRYBOT_URL= https://gold.skia.org/search?issue=2433233003
Review-Url: https://chromiumcodereview.appspot.com/2433233003
diff --git a/tests/MathTest.cpp b/tests/MathTest.cpp
index 1dd8223..41a4104 100644
--- a/tests/MathTest.cpp
+++ b/tests/MathTest.cpp
@@ -534,6 +534,12 @@
REPORTER_ASSERT(reporter, result == 3);
}
+ {
+ REPORTER_ASSERT(reporter, (SkFixedRoundToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
+ REPORTER_ASSERT(reporter, (SkFixedFloorToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
+ REPORTER_ASSERT(reporter, (SkFixedCeilToFixed(-SK_Fixed1 * 10) >> 1) == -SK_Fixed1 * 5);
+ }
+
unittest_fastfloat(reporter);
unittest_isfinite(reporter);
unittest_half(reporter);