#include <stdio.h>
#include <math.h>
-#if !HAVE_ASM_AMD64_128
+#if !HAVE_ASM_128
void Fixed128_add(struct Fixed128 *r, const struct Fixed128 *a, const struct Fixed128 *b) {
uint64_t s = 0;
int n;
s >>= 32;
}
}
-#endif
-#if !HAVE_ASM_AMD64_128
void Fixed128_sub(struct Fixed128 *r, const struct Fixed128 *a, const struct Fixed128 *b) {
uint64_t s = 1;
int n;
s >>= 32;
}
}
-#endif
-#if !HAVE_ASM_AMD64_128
int Fixed128_neg(struct Fixed128 *r, const struct Fixed128 *a) {
uint64_t s = 1;
int n;
else
return 0;
}
-#endif
-#if !HAVE_ASM_AMD64_128
static int Fixed128_mul_unsigned(struct Fixed128 *r, const struct Fixed128 *a, const struct Fixed128 *b) {
int n, m, i;
/* Clear result accumulator */
return 1;
}
-#if !HAVE_ASM_AMD64_128
+#if !HAVE_ASM_128
void Fixed128_shl_unsigned(struct Fixed128 *a) {
int n;
for(n = NFIXED128 - 1; n > 0; --n)
}
#endif
-#if !HAVE_ASM_AMD64_128
+#if !HAVE_ASM_128
void Fixed128_shr_unsigned(struct Fixed128 *a) {
int n;
for(n = 0; n < NFIXED128 - 1; ++n)
uint64_t Fixed64_mul_unsigned(uint64_t a, uint64_t b);
static uint64_t Fixed64_div_unsigned(uint64_t a, uint64_t b);
-#if ! HAVE_ASM_AMD64_64
+#if ! HAVE_ASM_64
Fixed64 Fixed64_mul(Fixed64 a, Fixed64 b) {
Fixed64 r;
int sign = 0;
}
static count_t iterate(fixed128 zx, fixed128 zy, fixed128 cx, fixed128 cy, int maxiters) {
-#if HAVE_ASM && NFIXED128 == 4
+#if HAVE_ASM_128 && NFIXED128 == 4
int rawCount = Fixed128_iterate(&zx.f, &zy.f, &cx.f, &cy.f, maxiters);
if(rawCount == maxiters)
return rawCount;
static count_t iterate(arith_t zxa, arith_t zya, arith_t cxa, arith_t cya,
int maxiters) {
fixed64 zx = zxa, zy = zya, cx = cxa, cy = cya;
-#if HAVE_ASM_AMD64_64
+#if HAVE_ASM_64
double r2;
int rawCount = Fixed64_iterate(zx.f, zy.f, cx.f, cy.f, &r2, maxiters);
if(rawCount == maxiters)
#else
#define LIBMANDY_API __declspec(dllimport)
#endif
-#define HAVE_ASM_AMD64_64 1
-#define HAVE_ASM_AMD64_128 1
+// On Windows: use assembler if possible
+# if _M_AMD64
+# define HAVE_ASM_64 1
+# define HAVE_ASM_128 1
+# endif
#endif
+// On Unix: use assembler if requested to by configure script
#if HAVE_ASM
-# define HAVE_ASM_AMD64_64 1
-# define HAVE_ASM_AMD64_128 1
+# define HAVE_ASM_64 1
+# define HAVE_ASM_128 1
#endif
#ifndef LIBMANDY_API