projects
/
u
/
mdw
/
catacomb
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Implement efficient reduction for pleasant-looking primes.
[u/mdw/catacomb]
/
mp-sqrt.c
diff --git
a/mp-sqrt.c
b/mp-sqrt.c
index
6b0f602
..
7b65ec0
100644
(file)
--- a/
mp-sqrt.c
+++ b/
mp-sqrt.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: mp-sqrt.c,v 1.
2 2000/10/08 12:02:21
mdw Exp $
+ * $Id: mp-sqrt.c,v 1.
3 2001/02/03 12:00:29
mdw Exp $
*
* Compute integer square roots
*
*
* Compute integer square roots
*
@@
-30,6
+30,10
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: mp-sqrt.c,v $
/*----- Revision history --------------------------------------------------*
*
* $Log: mp-sqrt.c,v $
+ * Revision 1.3 2001/02/03 12:00:29 mdw
+ * Now @mp_drop@ checks its argument is non-NULL before attempting to free
+ * it. Note that the macro version @MP_DROP@ doesn't do this.
+ *
* Revision 1.2 2000/10/08 12:02:21 mdw
* Use @MP_EQ@ instead of @MP_CMP@.
*
* Revision 1.2 2000/10/08 12:02:21 mdw
* Use @MP_EQ@ instead of @MP_CMP@.
*
@@
-71,8
+75,7
@@
mp *mp_sqrt(mp *d, mp *a)
MP_SHRINK(a);
if (a->v == a->vl) {
MP_SHRINK(a);
if (a->v == a->vl) {
- if (d)
- mp_drop(d);
+ mp_drop(d);
return (MP_ZERO);
}
return (MP_ZERO);
}
@@
-116,8
+119,7
@@
mp *mp_sqrt(mp *d, mp *a)
/* --- Finished, at last --- */
mp_drop(q);
/* --- Finished, at last --- */
mp_drop(q);
- if (r)
- mp_drop(r);
+ mp_drop(r);
return (d);
}
return (d);
}