INNER CODE UNIT · Python

t

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

    t = 1<<(a-self.d)
    return divmod(x, t)

  def quot(self, x):
    (x0, x1) = self.getTop(x)
    a = x.bit_length()
    s= 2*self.d -(a - self.l + 1)
    return (x0 * self.p0) >> s

  def check(self, x):
    (x0, x1) = self.getTop(x)
    a = x.bit_length()
    (Q, R) = divmod(x, self.p)
    S = 1<<(2*self.d - (a - self.l + 1))
    (Q2, R2) = divmod(x0 * self.p0, S)
    lhs = S * self.p * (Q - Q2)
    rhs = S * x1 + self.p1 * x0 - S * R + self.p * R2
    if Q == Q2 or Q == Q2 + 1:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…