Skip to content

Commit 3163999

Browse files
author
Andrii Verbytskyi
committed
OK
1 parent 6aed397 commit 3163999

File tree

5 files changed

+33
-25
lines changed

5 files changed

+33
-25
lines changed

src/cache.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ namespace std {
1717
seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
1818
}
1919

20-
#ifdef __x86_64__
20+
#if defined(__x86_64__) || defined(__i386__)
2121
template <>
2222
struct hash<ql::qdouble> : public __hash_base<size_t, ql::qdouble>
2323
{

src/qcdloop/maths.h

Lines changed: 21 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,43 +21,47 @@ namespace ql
2121
{
2222
// Logarithms
2323
inline double Log(double const& x) { return std::log(x); }
24-
#ifdef __x86_64__
24+
#if defined(__x86_64__) || defined(__i386__)
2525
inline qdouble Log(qdouble const& x) { return logq(x); }
2626
inline qcomplex Log(qcomplex const& x) { return clogq(x); }
27-
#else
27+
#endif
28+
#if defined(__aarch64__)
2829
inline qdouble Log(qdouble const& x) { return std::log(x); }
2930
inline qcomplex Log(qcomplex const& x) { return clogl(x); }
3031
#endif
3132
inline complex Log(complex const& x) { return std::log(x); }
3233

3334
// Power
3435
inline double Pow(double const& x, int const& a) { return std::pow(x, a); }
35-
#ifdef __x86_64__
36+
#if defined(__x86_64__) || defined(__i386__)
3637
inline qdouble Pow(qdouble const& x, int const& a) { return powq(x,a); }
3738
inline qcomplex Pow(qcomplex const& x, int const& a){ return cpowq(x,a); }
38-
#else
39+
#endif
40+
#if defined(__aarch64__)
3941
inline qdouble Pow(qdouble const& x, int const& a) { return std::pow(x,a); }
4042
inline qcomplex Pow(qcomplex const& x, int const& a){ return cpowl(x,a); }
4143
#endif
4244
inline complex Pow(complex const& x, int const& a) { return std::pow(x,a); }
4345

4446
// Root
4547
inline double Sqrt(double const& x) { return std::sqrt(x); }
46-
#ifdef __x86_64__
48+
#if defined(__x86_64__) || defined(__i386__)
4749
inline qdouble Sqrt(qdouble const& x) { return sqrtq(x); }
4850
inline qcomplex Sqrt(qcomplex const& x){ return csqrtq(x); }
49-
#else
51+
#endif
52+
#if defined(__aarch64__)
5053
inline qdouble Sqrt(qdouble const& x) { return std::sqrt(x); }
5154
inline qcomplex Sqrt(qcomplex const& x){ return csqrtl(x); }
5255
#endif
5356
inline complex Sqrt(complex const& x) { return std::sqrt(x); }
5457

5558
// Absolute value
5659
inline double Abs(double const& x) { return std::abs(x); }
57-
#ifdef __x86_64__
60+
#if defined(__x86_64__) || defined(__i386__)
5861
inline qdouble Abs(qdouble const& x) { return fabsq(x);}
5962
inline qdouble Abs(qcomplex const& x) { return cabsq(x); }
60-
#else
63+
#endif
64+
#if defined(__aarch64__)
6165
inline qdouble Abs(qdouble const& x) { return std::abs(x);}
6266
inline qdouble Abs(qcomplex const& x) { return cabsl(x); }
6367
#endif
@@ -67,25 +71,28 @@ namespace ql
6771
inline double Imag(double const& x) { UNUSED(x); return 0; }
6872
inline qdouble Imag(qdouble const& x) { UNUSED(x); return qdouble(0); }
6973
inline double Imag(complex const& x) { return x.imag(); }
70-
#ifdef __x86_64__
74+
#if defined(__x86_64__) || defined(__i386__)
7175
inline qdouble Imag(qcomplex const& x){ return cimagq(x);}
72-
#else
76+
#endif
77+
#if defined(__aarch64__)
7378
inline qdouble Imag(qcomplex const& x){ return cimagl(x);}
7479
#endif
7580

7681
inline double Real(double const& x) { return x; }
7782
inline qdouble Real(qdouble const& x) { return x; }
7883
inline double Real(complex const& x) { return x.real(); }
79-
#ifdef __x86_64__
84+
#if defined(__x86_64__) || defined(__i386__)
8085
inline qdouble Real(qcomplex const& x) { return crealq(x); }
81-
#else
86+
#endif
87+
#if defined(__aarch64__)
8288
inline qdouble Real(qcomplex const& x) { return creall(x); }
8389
#endif
8490

8591
inline complex Conjg(complex const& x) { return std::conj(x); }
86-
#ifdef __x86_64__
92+
#if defined(__x86_64__) || defined(__i386__)
8793
inline qcomplex Conjg(qcomplex const& x){ return conjq(x); }
88-
#else
94+
#endif
95+
#if defined(__aarch64__)
8996
inline qcomplex Conjg(qcomplex const& x){ return conjl(x); }
9097
#endif
9198

src/qcdloop/types.h

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,18 @@
77

88
#pragma once
99

10-
#ifdef __x86_64__
10+
#if defined(__x86_64__) || defined(__i386__)
1111
extern "C" { // for gcc4.7 compatibility
1212
#include <quadmath.h>
1313
}
14-
#else
1514
#endif
16-
#ifdef __aarch64__
15+
#if defined(__aarch64__)
1716
#include <stdlib.h>
1817
#include <complex.h>
1918
#include <tgmath.h>
2019
#include <float.h>
21-
typedef long double __float128;
22-
using __complex128 = long double _Complex ;
20+
using __float128 = long double;
21+
using __complex128 = long double _Complex;
2322
extern "C" {
2423
__complex128 conjl(__complex128);
2524
__float128 cimagl(__complex128);
@@ -50,7 +49,7 @@ namespace ql
5049
namespace std
5150
{
5251

53-
#ifdef __x86_64__
52+
#if defined(__x86_64__) || defined(__i386__)
5453
//! implementation of operator<< for qdouble
5554
ostream& operator<<(std::ostream& out, ql::qdouble f);
5655
#endif

src/tools.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ namespace ql {
2020
template<typename TOutput, typename TMass, typename TScale>
2121
Tools<TOutput,TMass,TScale>::Tools():
2222
_qlonshellcutoff(is_same<TScale,double>::value ? 1e-10 : 1e-20q),
23-
#ifdef __x86_64__
23+
#if defined(__x86_64__) || defined(__i386__)
2424
_pi(is_same<TScale,double>::value ? M_PI : M_PIq),
25-
#else
25+
#endif
26+
#if defined(__aarch64__)
2627
_pi(is_same<TScale,double>::value ? M_PI : M_PIl),
2728
#endif
2829
_pi2 (_pi*_pi),

src/types.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace std
1111
{
12-
#ifdef __x86_64__
12+
#if defined(__x86_64__) || defined(__i386__)
1313
ostream& operator<<(std::ostream& out, ql::qdouble f)
1414
{
1515
char buf[200];
@@ -25,7 +25,8 @@ namespace std
2525
out << "(" << crealq(f) << "," << cimagq(f) << ")";
2626
return out;
2727
}
28-
#else
28+
#endif
29+
#if defined(__aarch64__)
2930
ostream& operator<<(std::ostream& out, ql::qcomplex f)
3031
{
3132
out << "(" << creall(f) << "," << cimagl(f) << ")";

0 commit comments

Comments
 (0)