On Sat, Aug 22, 2015 at 04:26:53PM +0200, Nicolas George wrote: > 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.
i dont know what "morally negative" means exactly but convertion of out of range values to signed integers is not undefined behavior in C. It is implementation defined or raises a implementation defined signal Please see 6.3.1.3 Signed and unsigned integers in ISO/IEC 9899:TC3 I doubt that FFmpeg will work on platforms that define this significantly differently than how it is defined for the currently supported platforms, [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 3 "Rare item" - "Common item with rare defect or maybe just a lie" "Professional" - "'Toy' made in china, not functional except as doorstop" "Experts will know" - "The seller hopes you are not an expert"
signature.asc
Description: Digital signature
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel