From 085d1b2cfb6f8dd68b3313952a09e325f272d142 Mon Sep 17 00:00:00 2001 From: Luke Kenneth Casson Leighton Date: Fri, 10 Jul 2020 20:49:49 +0100 Subject: [PATCH] rename trunc_div/rem to trunc_divs --- src/nmutil/divmod.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/nmutil/divmod.py b/src/nmutil/divmod.py index 488e225..99e6847 100644 --- a/src/nmutil/divmod.py +++ b/src/nmutil/divmod.py @@ -1,21 +1,21 @@ -# this is a POWER ISA 3.0B compatible div function +# this is a POWER ISA 3.0B compatible *signed* div function # however it is also the c, c++, rust, java *and* x86 way of doing things -def trunc_div(n, d): +def trunc_divs(n, d): abs_n = abs(n) abs_d = abs(d) abs_q = abs_n // abs_d - #print ("trunc_div", n.value, d.value, - # abs_n.value, abs_d.value, abs_q.value, - # n == abs_n, d == abs_d) + print ("trunc_div", n.value, d.value, + abs_n.value, abs_d.value, abs_q.value, + n == abs_n, d == abs_d) if (n == abs_n) == (d == abs_d): return abs_q return -abs_q -# this is a POWER ISA 3.0B compatible mod / remainder function +# this is a POWER ISA 3.0B compatible *signed* mod / remainder function # however it is also the c, c++, rust, java *and* x86 way of doing things -def trunc_rem(n, d): - m = d * trunc_div(n, d) +def trunc_rems(n, d): + m = d * trunc_divs(n, d) m.bits = n.bits # cheat - really shouldn't do this. mul returns full length return n - m -- 2.30.2