mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Support for compiling on 32-bit platforms. The main issue was BN_ULONG size and not using 'long' where
'long long' or 'uint64' should be used.
This commit is contained in:
22
src/cpp/ripple/BigNum64.h
Normal file
22
src/cpp/ripple/BigNum64.h
Normal file
@@ -0,0 +1,22 @@
|
||||
|
||||
// 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_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);
|
||||
}
|
||||
Reference in New Issue
Block a user