aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/libmp/port/mptouv.c5
-rw-r--r--src/libmp/port/mptov.c5
2 files changed, 8 insertions, 2 deletions
diff --git a/src/libmp/port/mptouv.c b/src/libmp/port/mptouv.c
index 2548303c..aa5af05b 100644
--- a/src/libmp/port/mptouv.c
+++ b/src/libmp/port/mptouv.c
@@ -22,7 +22,10 @@ uvtomp(uvlong v, mpint *b)
return b;
for(s = 0; s < VLDIGITS && v != 0; s++){
b->p[s] = v;
- v >>= sizeof(mpdigit)*8;
+ if(sizeof(mpdigit) == sizeof(uvlong))
+ v = 0;
+ else
+ v >>= sizeof(mpdigit)*8;
}
b->top = s;
return b;
diff --git a/src/libmp/port/mptov.c b/src/libmp/port/mptov.c
index b09718ef..86da9943 100644
--- a/src/libmp/port/mptov.c
+++ b/src/libmp/port/mptov.c
@@ -28,7 +28,10 @@ vtomp(vlong v, mpint *b)
uv = v;
for(s = 0; s < VLDIGITS && uv != 0; s++){
b->p[s] = uv;
- uv >>= sizeof(mpdigit)*8;
+ if(sizeof(mpdigit) == sizeof(uvlong))
+ uv = 0;
+ else
+ uv >>= sizeof(mpdigit)*8;
}
b->top = s;
return b;