TpHash icon indicating copy to clipboard operation
TpHash copied to clipboard

colors is always kGreen

Open RetVal opened this issue 10 years ago • 2 comments

in +(uint8_t *) convertToGreyscale64Array:(UIImage *)i, colors is always kGreen, kRed and kBlue if expression is always false

RetVal avatar Jul 03 '14 02:07 RetVal

What is your means?

tinyfool avatar Jul 03 '14 03:07 tinyfool

in method +(uint8_t *) convertToGreyscale64Array:(UIImage *)i, var colors is always kGreen, and never be changed in the follow code, if (colors & kRed) {sum += (rgbPixel>>24)&255; count++;} if (colors & kGreen) {sum += (rgbPixel>>16)&255; count++;} if (colors & kBlue) {sum += (rgbPixel>>8)&255; count++;}

these expression only 'colors & kGreen' is always true, others are always false and the body will never be executed

RetVal avatar Jul 03 '14 03:07 RetVal