diff --git a/include/core/SkTemplates.h b/include/core/SkTemplates.h index 3060f9ef27..a06c856a32 100644 --- a/include/core/SkTemplates.h +++ b/include/core/SkTemplates.h @@ -66,7 +66,9 @@ template static D* SkTAddOffset(S* ptr, size_t byteOffs /** Returns true if the source value 's' will fit in the destination type 'D'. */ template inline bool SkTFitsIn(S s) { - return static_cast(s) == s; + // the cast to is just to restore the signedness of S, to avoid + // sign-unsigned comparison warnings. + return static_cast(static_cast(s)) == s; } /** \class SkAutoTCallVProc