summaryrefslogtreecommitdiffstats
path: root/mpi/mpi.c
diff options
context:
space:
mode:
Diffstat (limited to 'mpi/mpi.c')
-rw-r--r--mpi/mpi.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/mpi/mpi.c b/mpi/mpi.c
index 96dc71d4..42a267b5 100644
--- a/mpi/mpi.c
+++ b/mpi/mpi.c
@@ -606,10 +606,9 @@ mp_err mp_get_uintptr(mp_int *mp, uint_ptr_t *z)
mp_err mp_get_intptr(mp_int *mp, int_ptr_t *z)
{
uint_ptr_t tmp = 0;
- int_ptr_t out;
mp_get_uintptr(mp, &tmp);
- out = tmp;
- *z = (SIGN(mp) == MP_NEG) ? -out : out;
+ /* Reliance on bitwise unsigned to two's complement conversion */
+ *z = (int_ptr_t) tmp;
return MP_OKAY;
}