[FFmpeg-devel] [PATCH] all: silence clang -Wabsolute-value for unsigned subtractions
george at nsup.org
Sun Aug 23 10:20:17 CEST 2015
Le quintidi 5 fructidor, an CCXXIII, Ganesh Ajjanagadde a écrit :
> >> + 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)));
> The cast idea is incorrect as stated, though your idea is sound:
> int is not guaranteed to be of 32 bits on all platforms.
> Casting a uint32_t to an int will be bad.
Look at the code itself: the numbers are all smaller than 768. The cast in
that case is completely reliable.
> I assume this is what you had in mind with your macro idea.
I had in mind just a local macro to make that precise part of the code more
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 819 bytes
Desc: Digital signature
More information about the ffmpeg-devel