Files
rippled/src/cpp/ripple/BigNum64.h
JoelKatz 27a7ac75de Add, subtract, multiply, and divide with specified rounding direction.
CAUTION: This is still untested and undebugged code. Only divRound
has been even slightly tested.
2013-03-10 21:22:01 -07:00

29 lines
512 B
C

// Support 64-bit word operations on 32-bit platforms
static int BN_add_word64(BIGNUM *a, uint64 w)
{
CBigNum bn(w);
return BN_add(a, &bn, a);
}
static int BN_sub_word64(BIGNUM *a, uint64 w)
{
CBigNum bn(w);
return BN_sub(a, &bn, a);
}
static int BN_mul_word64(BIGNUM *a, uint64 w)
{
CBigNum bn(w);
CAutoBN_CTX ctx;
return BN_mul(a, &bn, a, ctx);
}
static uint64 BN_div_word64(BIGNUM *a, uint64 w)
{
CBigNum bn(w);
CAutoBN_CTX ctx;
return (BN_div(a, NULL, a, &bn, ctx) == 1) ? 0 : ((uint64)-1);
}