diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2021-03-18 09:56:52 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2021-03-18 09:56:52 +0000 |
commit | a1aa835c46212c3ed4ed2626af11b5e59f1adb32 (patch) | |
tree | 56511d3e5ced45569519654ca5eb0ad54cb920e0 | |
parent | a9c41e4ab0e4021f8d69935075d4605a27581dd6 (diff) | |
download | mpfr-a1aa835c46212c3ed4ed2626af11b5e59f1adb32.tar.gz |
[tools/mpfrlint] Detect mpn_mul_n with identical 2nd and 3rd arguments,
which can be replaced by the faster mpn_sqr.
git-svn-id: https://scm.gforge.inria.fr/anonscm/svn/mpfr/trunk@14478 280ebfd0-de03-0410-8827-d642c229c3f4
-rwxr-xr-x | tools/mpfrlint | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/mpfrlint b/tools/mpfrlint index c71d92d71..56d1e61dc 100755 --- a/tools/mpfrlint +++ b/tools/mpfrlint @@ -375,6 +375,14 @@ err-if-output --msg='Use mpfr_sqr instead of mpfr_mul.' "mul/sqr" perl -ne \ do { $u =~ tr/ //d; $v =~ tr/ //d; $u eq $v and print "$ARGV: $_" }' \ src/*.[ch]~src/(mul|sqr).c +# Detect mpn_mul_n with identical 2nd and 3rd arguments, which can be +# replaced by mpn_sqr. +err-if-output --msg='Use mpn_sqr instead of mpn_mul_n.' "mpn mul/sqr" \ + perl -ne '($u,$v) = /mpn_mul_n *\([^,]*,([^,]*),([^,]*),/ and + !/# *define +mpn_sqr/ and + do { $u =~ tr/ //d; $v =~ tr/ //d; $u eq $v and print "$ARGV: $_" }' \ + src/*.[ch] + # Re-seeding mpfr_rands in the tests is bad practice, as it would affect # later tests, defeating the purpose of GMP_CHECK_RANDOMIZE. err-if-output \ |