INNER CODE UNIT · Python

ApproxMul

herumi/mcl · misc/mul-approx.py:50

class ApproxMul:
  def __init__(self, p, d):
    self.p = p
    self.d = d
    self.l = p.bit_length()
    t = 1<<(d+self.l-1)
    (q, r) = divmod(t, self.p)
    self.p0 = q
    self.p1 = r

  def __str__(self):
    return f'''p={self.p}
d={self.d}
l={self.l}
p0={self.p0}
p1={self.p1}'''

  def getTop(self, x):

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…