1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
|
From: Ruben Undheim <ruben.undheim@gmail.com>
Date: Sat, 14 May 2016 15:44:13 +0200
Subject: This patch fixes an FTBFS due to std::infinite not available
Bug-Debian: https://bugs.debian.org/822408
---
frontends/ast/ast.cc | 4 ----
passes/cmds/qwp.cc | 7 ++++---
2 files changed, 4 insertions(+), 7 deletions(-)
diff --git a/frontends/ast/ast.cc b/frontends/ast/ast.cc
index fd27240..ef392bd 100644
--- a/frontends/ast/ast.cc
+++ b/frontends/ast/ast.cc
@@ -873,11 +873,7 @@ RTLIL::Const AstNode::realAsConst(int width)
{
double v = round(realvalue);
RTLIL::Const result;
-#ifdef EMSCRIPTEN
if (!isfinite(v)) {
-#else
- if (!std::isfinite(v)) {
-#endif
result.bits = std::vector<RTLIL::State>(width, RTLIL::State::Sx);
} else {
bool is_negative = v < 0;
diff --git a/passes/cmds/qwp.cc b/passes/cmds/qwp.cc
index 1b800b6..c6e0573 100644
--- a/passes/cmds/qwp.cc
+++ b/passes/cmds/qwp.cc
@@ -19,6 +19,7 @@
#include "kernel/yosys.h"
#include "kernel/sigtools.h"
+#include <math.h>
#undef LOG_MATRICES
#undef PYPLOT_EDGES
@@ -364,7 +365,7 @@ struct QwpWorker
double c = alt_mode ? alt_midpos : midpos;
double r = alt_mode ? alt_radius : radius;
- if (std::isfinite(v)) {
+ if (isfinite(v)) {
v = min(v, c+r);
v = max(v, c-r);
} else {
@@ -546,14 +547,14 @@ struct QwpWorker
double rel_pos = node.pos - median;
if (rel_pos < 0) {
node.pos = midpos + left_scale*rel_pos;
- if (std::isfinite(node.pos)) {
+ if (isfinite(node.pos)) {
node.pos = min(node.pos, midpos);
node.pos = max(node.pos, midpos - radius);
} else
node.pos = midpos - radius/2;
} else {
node.pos = midpos + right_scale*rel_pos;
- if (std::isfinite(node.pos)) {
+ if (isfinite(node.pos)) {
node.pos = max(node.pos, midpos);
node.pos = min(node.pos, midpos + radius);
} else
|