Subject: | Won't build with Microsoft Compilers |
Hi,
Patch is attached.
The 2 Microsoft Compilers that I used were 32-bit 7.0 (_MSC_VER == 1300)
with perl-5.10.0 and 64-bit 8.0 (_MSC_VER == 1400) with perl-5.16.0.
In both cases I was using the compiler that built perl.
Neither of those compilers have stdint.h.
I think that 10.0 (_MSC_VER == 1600) does come with such a header file,
though I've no idea what it contains.
I don't know about 9.0 (_MSC_VER == 1500).
With the attached patch applied, Math-Prime-Util-0.10 then built and
tested fine with those 2 Microsoft compilers - with no affect on my
MinGW (gcc compiler) builds.
Cheers,
Rob
Subject: | M-P-U-diff.txt |
--- ptypes.h_orig Wed Jul 18 23:24:11 2012
+++ ptypes.h Wed Jul 18 23:33:30 2012
@@ -2,7 +2,9 @@
#define MPU_PTYPES_H
#define __STDC_LIMIT_MACROS
+#ifndef _MSC_VER
#include <stdint.h>
+#endif
#include "EXTERN.h"
#include "perl.h"
--- util.c_orig Thu Jul 19 16:53:04 2012
+++ util.c Thu Jul 19 16:52:52 2012
@@ -8,6 +8,10 @@
#define INFINITY (DBL_MAX + DBL_MAX)
#endif
+#ifdef _MSC_VER
+#define exp2(x) pow(2.0,x)
+#endif
+
#include "ptypes.h"
#include "util.h"
#include "sieve.h"
--- XS.xs_orig Thu Jul 19 16:26:18 2012
+++ XS.xs Thu Jul 19 16:29:29 2012
@@ -274,6 +274,7 @@
} else {
/* trial divisions */
if (verbose) printf("doing trial on %"UVuf"\n", n);
+ {
UV f = tlim;
UV m = tlim % 30;
UV limit = (UV) (sqrt(n)+0.1);
@@ -289,6 +290,7 @@
m = nextwheel30[m];
}
break; /* We just factored n via trial division. Exit loop. */
+ }
}
}
/* n is now prime (or 1), so add to already-factored stack */