about summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorAjax <commial@gmail.com>2015-11-10 15:01:14 +0100
committerAjax <commial@gmail.com>2015-11-10 15:01:14 +0100
commit4892fd18de5dff99267f43e584717518d3003a0d (patch)
tree3d320b02931a3863f070f85115d665d815f97352
parent70ddb1057b3543b0fd0f656c3f67f33d067fb5ad (diff)
downloadmiasm-4892fd18de5dff99267f43e584717518d3003a0d.tar.gz
miasm-4892fd18de5dff99267f43e584717518d3003a0d.zip
x86/TCC: add `fpatan`
-rw-r--r--miasm2/ir/translators/C.py2
-rw-r--r--miasm2/jitter/vm_mngr.c11
-rw-r--r--miasm2/jitter/vm_mngr.h1
3 files changed, 13 insertions, 1 deletions
diff --git a/miasm2/ir/translators/C.py b/miasm2/ir/translators/C.py
index ae305156..51de5f1f 100644
--- a/miasm2/ir/translators/C.py
+++ b/miasm2/ir/translators/C.py
@@ -104,7 +104,7 @@ class TranslatorC(Translator):
             elif (expr.op.startswith('cpuid') or
                   expr.op.startswith("fcom")  or
                   expr.op in ["fadd", "fsub", "fdiv", 'fmul', "fscale",
-                              "fprem", "fyl2x"]):
+                              "fprem", "fyl2x", "fpatan"]):
                 return "%s(%s, %s)" % (expr.op, self.from_expr(expr.args[0]),
                                        self.from_expr(expr.args[1]))
             elif expr.op == "segm":
diff --git a/miasm2/jitter/vm_mngr.c b/miasm2/jitter/vm_mngr.c
index b7de5639..16e0a56f 100644
--- a/miasm2/jitter/vm_mngr.c
+++ b/miasm2/jitter/vm_mngr.c
@@ -1276,6 +1276,17 @@ double fyl2x(double a, double b)
 	return c;
 }
 
+double fpatan(double a, double b)
+{
+	double c;
+	c = atan2(b, a);
+#ifdef DEBUG_MIASM_DOUBLE
+	dump_float();
+	printf("arctan(%e / %e) -> %e\n", b, a, c);
+#endif
+	return c;
+}
+
 unsigned int fcom_c0(double a, double b)
 {
 	if (a>=b)
diff --git a/miasm2/jitter/vm_mngr.h b/miasm2/jitter/vm_mngr.h
index 12904730..a9f218b1 100644
--- a/miasm2/jitter/vm_mngr.h
+++ b/miasm2/jitter/vm_mngr.h
@@ -373,6 +373,7 @@ double fabs(double a);
 double fprem(double a, double b);
 double fchs(double a);
 double fyl2x(double a, double b);
+double fpatan(double a, double b);
 unsigned int fcom_c0(double a, double b);
 unsigned int fcom_c1(double a, double b);
 unsigned int fcom_c2(double a, double b);