mask = (1 << d) - 1;  save = 0; for(ix = USED(mp) - 1; ix >= 0; ix--) { next = DIGIT(mp, ix) & mask; DIGIT(mp, ix) = (DIGIT(mp, ix) >> d) | (save << (DIGIT_BIT - d)); save = next;
if (d) { mask = (1 << d) - 1; save = 0; for(ix = USED(mp) - 1; ix >= 0; ix--) { next = DIGIT(mp, ix) & mask; DIGIT(mp, ix) = (DIGIT(mp, ix) >> d) | (save << (DIGIT_BIT - d)); save = next; }
void     s_mp_div_2d(mp_int *mp, mp_digit d){  int       ix;  mp_digit  save, next, mask;  s_mp_rshd(mp, d / DIGIT_BIT);  d %= DIGIT_BIT;  mask = (1 << d) - 1;  save = 0;  for(ix = USED(mp) - 1; ix >= 0; ix--) {    next = DIGIT(mp, ix) & mask;    DIGIT(mp, ix) = (DIGIT(mp, ix) >> d) | (save << (DIGIT_BIT - d));    save = next;  }  s_mp_clamp(mp);} /* end s_mp_div_2d() */