mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
CAUTION: This is still untested and undebugged code. Only divRound has been even slightly tested.
29 lines
512 B
C
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);
|
|
}
|