about summary refs log tree commit diff stats
path: root/miasm/core/modint.py
diff options
context:
space:
mode:
Diffstat (limited to 'miasm/core/modint.py')
-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