[FFmpeg-devel] [PATCH] all: silence clang -Wabsolute-value for unsigned subtractions
Nicolas George
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
readable.
Regards,
--
Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150823/1abd6e13/attachment.sig>
More information about the ffmpeg-devel
mailing list