[FFmpeg-devel] [PATCH] tests: drop bc dependency

Clément Bœsch u at pkh.me
Sun Feb 8 10:27:14 CET 2015


On Tue, Jan 20, 2015 at 09:58:33PM +0100, Reimar Döffinger wrote:
> On Mon, Jan 19, 2015 at 10:58:02PM +0100, Clément Bœsch wrote:
> > -    echo "scale=2; v = $1 - $2; if (v < 0) v = -v; if (v > $3) r = 1; r" | bc
> > +    awk "BEGIN { v=$1-$2; printf \"%d\\n\", ((v<0?v:-v) > $3) ? 1 : 0 }"
> 
> I'd suggest single quotes for the outer ones, then you do not need to
> escape \ and ".

Done. I kind of forgot i could 'foo '$1' bar'...

> Also it's broken, you inverted the absolute value condition.

Oh derp... fixed, sorry.

> Lastly, at least with gawk the last ?: is pointless, conditions evaluate
> to 1/0 like in C.

I originally tried it but probably did it wrong with the parenthesis.
Seems it works fine indeed. New patch attached. Thanks.

-- 
Clément B.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-tests-drop-bc-dependency.patch
Type: text/x-diff
Size: 839 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150208/50640c41/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 473 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20150208/50640c41/attachment.asc>


More information about the ffmpeg-devel mailing list