mirror of
https://github.com/mangosfour/server.git
synced 2025-12-17 07:37:03 +00:00
Initial Mangos Three Commit
This commit is contained in:
parent
bb91aa5933
commit
7665a09232
2444 changed files with 625144 additions and 0 deletions
24
dep/tomlib/Math/src/bn_mp_addmod.c
Normal file
24
dep/tomlib/Math/src/bn_mp_addmod.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include "tommath_private.h"
|
||||
#ifdef BN_MP_ADDMOD_C
|
||||
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
||||
/* SPDX-License-Identifier: Unlicense */
|
||||
|
||||
/* d = a + b (mod c) */
|
||||
int mp_addmod(const mp_int *a, const mp_int *b, const mp_int *c, mp_int *d)
|
||||
{
|
||||
int res;
|
||||
mp_int t;
|
||||
|
||||
if ((res = mp_init(&t)) != MP_OKAY) {
|
||||
return res;
|
||||
}
|
||||
|
||||
if ((res = mp_add(a, b, &t)) != MP_OKAY) {
|
||||
mp_clear(&t);
|
||||
return res;
|
||||
}
|
||||
res = mp_mod(&t, c, d);
|
||||
mp_clear(&t);
|
||||
return res;
|
||||
}
|
||||
#endif
|
||||
Loading…
Add table
Add a link
Reference in a new issue