add comments telling people to keep the asm and python versions in sync
authorJacob Lifshay <programmerjake@gmail.com>
Mon, 16 Oct 2023 04:17:09 +0000 (21:17 -0700)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 1 Dec 2023 17:58:20 +0000 (17:58 +0000)
src/openpower/test/bigint/powmod.py

index 3ba5045ede005c9fbc5a2712c59a211caa353bc0..5fa237a7ab78a299278623c6f6df22c6fc101450 100644 (file)
@@ -380,6 +380,10 @@ class DivModKnuthAlgorithmD:
         return self.num_size + 1
 
     def python(self, n, d, log_regex=False, on_corner_case=lambda desc: None):
+        # IMPORTANT: do_log calls match up with the expected register values
+        # in the assembly version at that point in the algorithm, please don't
+        # "simplify" all the seemingly-redundant local variable assignments,
+        # they match what actually happens in the assembly version.
         do_log = _DivModRegsRegexLogger(enabled=log_regex, regs=self.regs).log
 
         do_log(locals(), "start",
@@ -649,6 +653,8 @@ class DivModKnuthAlgorithmD:
         return q, r
 
     def __asm_iter(self):
+        # IMPORTANT: the assembly matches up with the python version, if you
+        # make any changes, change the python version to match.
         if self.word_size != 64:
             raise NotImplementedError("only word_size == 64 is implemented")
         n_0 = self.regs["n_0"]