diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2015-05-20 13:38:01 +0200 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2015-05-20 15:50:58 +0200 |
commit | 50965e067371a905dca04f5f867d5dd497d85871 (patch) | |
tree | 942191ce3b4e67774e3db55d93dfc165a8822486 /libavcodec/mathops.c | |
parent | eb0c08bc6938d1e873097a9c02772787d85b54b8 (diff) | |
download | ffmpeg-50965e067371a905dca04f5f867d5dd497d85871.tar.gz |
avcodec: add mathops test
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/mathops.c')
-rw-r--r-- | libavcodec/mathops.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/libavcodec/mathops.c b/libavcodec/mathops.c new file mode 100644 index 0000000000..31c8e69e61 --- /dev/null +++ b/libavcodec/mathops.c @@ -0,0 +1,26 @@ +#include "mathops.h" + +#ifdef TEST + +#include <stdlib.h> + +int main(void) +{ + unsigned u; + + for(u=0; u<65536; u++) { + unsigned s = u*u; + unsigned root = ff_sqrt(s); + unsigned root_m1 = ff_sqrt(s-1); + if (s && root != u) { + fprintf(stderr, "ff_sqrt failed at %u with %u\n", s, root); + return 1; + } + if (u && root_m1 != u - 1) { + fprintf(stderr, "ff_sqrt failed at %u with %u\n", s, root); + return 1; + } + } + return 0; +} +#endif /* TEST */ |