/* Perform a multiply between a bigint an an (unsigned) integer  */
static bigint *ICACHE_FLASH_ATTR bi_int_multiply(BI_CTX *ctx, bigint *bi, comp i)
/* Perform a multiply between a bigint an an (unsigned) integer  */
static bigint *ICACHE_FLASH_ATTR bi_int_multiply(BI_CTX *ctx, bigint *bi, comp i)
{
    int j = 0, n = bia->size;
    bigint *biR = alloc(ctx, n + 1);
    comp carry = 0;
    comp *r = biR->comps;
    comp *a = bia->comps;
    check(bia);
    memset(r, 0, ((n+1)*COMP_BYTE_SIZE));
    do
    {
        long_comp tmp = *r + (long_comp)a[j]*b + carry;
        *r++ = (comp)tmp;
        carry = (comp)(tmp >> COMP_BIT_SIZE);
    } while (++j < n);
    *r = carry;
    bi_free(ctx, bia);
    return trim(biR);
}