bn_mp_set.c 372 B

1234567891011121314
  1. #include "tommath_private.h"
  2. #ifdef BN_MP_SET_C
  3. /* LibTomMath, multiple-precision integer library -- Tom St Denis */
  4. /* SPDX-License-Identifier: Unlicense */
  5. /* set to a digit */
  6. void mp_set(mp_int *a, mp_digit b)
  7. {
  8. a->dp[0] = b & MP_MASK;
  9. a->sign = MP_ZPOS;
  10. a->used = (a->dp[0] != 0u) ? 1 : 0;
  11. MP_ZERO_DIGITS(a->dp + a->used, a->alloc - a->used);
  12. }
  13. #endif