2020-12-28 21:40:37 +00:00
|
|
|
#include "tommath_private.h"
|
2014-12-10 21:56:49 +00:00
|
|
|
#ifdef BN_MP_SET_C
|
2020-12-28 21:40:37 +00:00
|
|
|
/* LibTomMath, multiple-precision integer library -- Tom St Denis */
|
|
|
|
/* SPDX-License-Identifier: Unlicense */
|
2014-12-10 21:56:49 +00:00
|
|
|
|
|
|
|
/* set to a digit */
|
2020-12-28 21:40:37 +00:00
|
|
|
void mp_set(mp_int *a, mp_digit b)
|
2014-12-10 21:56:49 +00:00
|
|
|
{
|
2020-12-28 21:40:37 +00:00
|
|
|
a->dp[0] = b & MP_MASK;
|
|
|
|
a->sign = MP_ZPOS;
|
|
|
|
a->used = (a->dp[0] != 0u) ? 1 : 0;
|
|
|
|
MP_ZERO_DIGITS(a->dp + a->used, a->alloc - a->used);
|
2014-12-10 21:56:49 +00:00
|
|
|
}
|
|
|
|
#endif
|