blob: acd372859ac8546de1b1c170a25481fe6943df3a (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
|
Index: mpi-1.8.6/mpi.c
===================================================================
--- mpi-1.8.6.orig/mpi.c 2011-12-10 17:41:38.000000000 -0800
+++ mpi-1.8.6/mpi.c 2011-12-10 17:44:35.000000000 -0800
@@ -573,6 +573,15 @@
return MP_OKAY;
}
+mp_err mp_set_word(mp_int *mp, mp_word w, int sign)
+{
+ USED(mp) = 2;
+ DIGIT(mp, 0) = w & MP_DIGIT_MAX;
+ DIGIT(mp, 1) = w & MP_DIGIT_MAX;
+ SIGN(mp) = sign;
+ return MP_OK;
+}
+
/*------------------------------------------------------------------------*/
/* {{{ Digit arithmetic */
Index: mpi-1.8.6/mpi.h
===================================================================
--- mpi-1.8.6.orig/mpi.h 2011-12-10 17:41:38.000000000 -0800
+++ mpi-1.8.6/mpi.h 2011-12-10 17:43:56.000000000 -0800
@@ -100,6 +100,7 @@
mp_err mp_set_int(mp_int *mp, long z);
mp_err mp_set_intptr(mp_int *mp, int_ptr_t z);
mp_err mp_get_intptr(mp_int *mp, int_ptr_t *z);
+mp_err mp_set_word(mp_int *mp, mp_word w, int sign);
/*------------------------------------------------------------------------*/
/* Single digit arithmetic */
|