Le quintidi 5 fructidor, an CCXXIII, Ganesh Ajjanagadde a écrit : > + /* cast for -Wabsolute-value in clang 3.5+ */ > + return abs((int) (t1 - t2)) + abs((int) ((c1 & 0x000000ff) - (c2 & > 0x000000ff))) + > + abs((int) (((c1 & 0x0000ff00) >> 8) - ((c2 & 0x0000ff00) >> 8))) + > + abs((int) (((c1 & 0x00ff0000) >> 16) - ((c2 & 0x00ff0000) >> 16)));
I believe this is not correct, with or without the cast (the cast is implicit due to the prototype of abs(), of course): if the result is morally negative, converting the morally-negative unsigned to signed is an undefined behaviour. The correct fix would probably be "abs((int)x - (int)y)". Hopefully, the compiler will generate the exact same code. A macro absdiff() would probably make things more readable. Not that you did not introduce the undefined behaviour. You just noticed it with that new warning. Regards, -- Nicolas George
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel