From 9e36143a34451aba972b157a53160f1badff9ceb Mon Sep 17 00:00:00 2001 From: rsc Date: Fri, 30 Dec 2005 17:06:50 +0000 Subject: fix shift --- src/libmp/port/mptouv.c | 5 ++++- src/libmp/port/mptov.c | 5 ++++- 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; -- cgit v1.2.3