Exemple #1
0
static int base58_encode_reverse(mrb_state *mrb, char *dst, const char *data, int length, const char *chars)
{
  Bignum *b = bignum_alloc(mrb, data, length);
  int index = 0;
  int i;
  
  do {
    dst[index] = chars[bignum_div(b, 58)];
    index++;
  } while (!bignum_is_zero(b));
  
  for (i = 0; i < length; ++i) {
    if (data[i] == 0) {
      dst[index] = chars[0];
      index++;
    }
    else {
      break;
    }
  }
  bignum_free(b);
  return index;
}
Exemple #2
0
static _rs_inline obj bignum_quotient( obj a, obj b )
{
    return bignum_div( a, b );
}