Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static bool fitsInBits(SkScalar x, int bits) {
- #ifdef SK_SCALAR_IS_FIXED
- x = SkAbs32(x);
- x += 1 << 7;
- x >>= 8;
- return x < (1 << (bits - 1));
- #else
- return SkScalarAbs(x) < (1 << (bits - 1));
- #endif
- }
- SkXfermode* SkArithmeticMode::Create(SkScalar k1, SkScalar k2,
- SkScalar k3, SkScalar k4)
- {
- if (fitsInBits(k1, 8) &&
- fitsInBits(k2, 16) &&
- fitsInBits(k2, 16) &&
- fitsInBits(k2, 24)) {
- ....
- }
- This suspicious code was found in Skia project by PVS-Studio static code analyzer.
- Warning message is:
- V501 There are identical sub-expressions 'fitsInBits(k2, 16)' to the left and to the right of the '&&' operator. SkArithmeticMode.cpp 211
- PVS-Studio is a static analyzer for detecting bugs in the source code of applications written in C, C++, C++11, C++/CX. Site: http://www.viva64.com/en/pvs-studio/
Advertisement
Add Comment
Please, Sign In to add comment