code: function mod_(x, n) {
    if (s4.length!=x.length)
      s4=dup(x);
    else
      copy_(s4, x);
    if (s5.length!=x.length)
      s5=dup(x);
    divide_(s4, n, s5, x);  //x = remainder of s4 / n
  }
docs: do x=x mod n for bigInts x and n.