about summary refs log tree commit diff stats
path: root/miasm/core
diff options
context:
space:
mode:
authorserpilliere <serpilliere@users.noreply.github.com>2020-12-04 06:59:35 +0100
committerGitHub <noreply@github.com>2020-12-04 06:59:35 +0100
commit34438feab8834e93deb57b51bd66a172be6e8135 (patch)
tree3b6e03207deebdb6dc0ff3d2f9b31895d937049a /miasm/core
parent72a8babc6ad2c13e49b12c0e79eeea61067ccc10 (diff)
parent73b6bc5f622941cc382ddb1e4c099029dd9ec3c4 (diff)
downloadfocaccia-miasm-34438feab8834e93deb57b51bd66a172be6e8135.tar.gz
focaccia-miasm-34438feab8834e93deb57b51bd66a172be6e8135.zip
Merge pull request #1319 from serpilliere/fix_z3_div_add_simpl
Fix z3 div; add simpl
Diffstat (limited to 'miasm/core')
-rw-r--r--miasm/core/modint.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/miasm/core/modint.py b/miasm/core/modint.py
index 2ecefed1..14b4dc2c 100644
--- a/miasm/core/modint.py
+++ b/miasm/core/modint.py
@@ -55,6 +55,20 @@ class moduint(object):
     def __div__(self, y):
         # Python: 8 / -7 == -2 (C-like: -1)
         # int(float) trick cannot be used, due to information loss
+        # Examples:
+        #
+        # 42 / 10 => 4
+        # 42 % 10 => 2
+        #
+        # -42 / 10 => -4
+        # -42 % 10 => -2
+        #
+        # 42 / -10 => -4
+        # 42 % -10 => 2
+        #
+        # -42 / -10 => 4
+        # -42 % -10 => -2
+
         den = int(y)
         num = int(self)
         result_sign = 1 if (den * num) >= 0 else -1