diff options
author | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2014-01-21 10:51:48 +0000 |
---|---|---|
committer | vlefevre <vlefevre@280ebfd0-de03-0410-8827-d642c229c3f4> | 2014-01-21 10:51:48 +0000 |
commit | 7b5c3675cbf485273ff345961d0c5c6b5ee16ba9 (patch) | |
tree | 2b186a74112d7760eee6ada21142754825954585 /src/mpfr-gmp.h | |
parent | 00667d834dd350d569a5639ba38956b48a0977bb (diff) | |
download | mpfr-7b5c3675cbf485273ff345961d0c5c6b5ee16ba9.tar.gz |
[src/mpfr-gmp.h] TMP_FREE optimization as tmp_marker is often null
(based on a patch by Patrick PĂ©lissier).
git-svn-id: svn://scm.gforge.inria.fr/svn/mpfr/trunk@8829 280ebfd0-de03-0410-8827-d642c229c3f4
Diffstat (limited to 'src/mpfr-gmp.h')
-rw-r--r-- | src/mpfr-gmp.h | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/mpfr-gmp.h b/src/mpfr-gmp.h index 120c07ce2..dff1a5bcb 100644 --- a/src/mpfr-gmp.h +++ b/src/mpfr-gmp.h @@ -306,7 +306,10 @@ __MPFR_DECLSPEC void mpfr_tmp_free _MPFR_PROTO ((struct tmp_marker *)); alloca (n) : mpfr_tmp_allocate (&tmp_marker, (n))) #define TMP_DECL(m) struct tmp_marker *tmp_marker #define TMP_MARK(m) (tmp_marker = 0) -#define TMP_FREE(m) mpfr_tmp_free (tmp_marker) +/* Note about TMP_FREE: For small precisions, tmp_marker is null as + the allocation is done on the stack (see TMP_ALLOC above). */ +#define TMP_FREE(m) \ + (MPFR_LIKELY (tmp_marker == NULL) ? (void) 0 : mpfr_tmp_free (tmp_marker)) #endif /* GMP Internal replacement */ |