summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2007-10-13 05:48:45 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2007-10-13 05:48:45 (GMT)
commitf25af41829e85c68d70184008ba1921077b01e07 (patch)
tree897ca9e90ca51a19aceab93a82319371f1132e4b
parent363fd5567167f40f4d625d5840955ca235673822 (diff)
downloadpbn-f25af41829e85c68d70184008ba1921077b01e07.zip
pbn-f25af41829e85c68d70184008ba1921077b01e07.tar.gz
pbn-f25af41829e85c68d70184008ba1921077b01e07.tar.bz2
pbn-f25af41829e85c68d70184008ba1921077b01e07.tar.xz
Encapsulate the gcc hack better.
-rw-r--r--pbn_divs.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/pbn_divs.c b/pbn_divs.c
index 3ce8191..bc8bd3c 100644
--- a/pbn_divs.c
+++ b/pbn_divs.c
@@ -20,20 +20,12 @@
#include "pbnint.h"
-#if defined(__GNUC__) && defined(__i386__) && PBN_ATOM_BITS == 32
-/* gcc won't generate divl for 64/32 -> 32, so help it out */
-# define GCC_HACK
-#endif
-
int pbn_divs(struct pbn **qp, pbn_satom_t *rp, struct pbn *n, pbn_satom_t d)
{
int i;
int len;
struct pbn *q;
pbn_atom_t c;
-#ifndef GCC_HACK
- pbn_2atom_t cc;
-#endif
int minus;
if (d == 0) {
@@ -57,7 +49,8 @@ int pbn_divs(struct pbn **qp, pbn_satom_t *rp, struct pbn *n, pbn_satom_t d)
q->minus = minus;
c = 0;
-#ifdef GCC_HACK
+#if defined(__GNUC__) && defined(__i386__) && PBN_ATOM_BITS == 32
+/* gcc won't generate divl for 64/32 -> 32, so help it out */
for (i = len-1; i >= 0; i--) {
asm("divl %4"
: "=d" (c), "=a" (q->num[i])
@@ -65,6 +58,7 @@ int pbn_divs(struct pbn **qp, pbn_satom_t *rp, struct pbn *n, pbn_satom_t d)
}
#else
for (i = len-1; i >= 0; i--) {
+ pbn_2atom_t cc;
cc = ((pbn_2atom_t)c << PBN_ATOM_BITS) + n->num[i];
/* N.B. the explicit casts allow some compilers to tell this is