commit 9e36143a34451aba972b157a53160f1badff9ceb parent af79ebc2b6faf92268193a43bd087dbf75840b41 Author: rsc <devnull@localhost> Date: Fri, 30 Dec 2005 17:06:50 +0000 fix shift Diffstat:
M | src/libmp/port/mptouv.c | | | 5 | ++++- |
M | 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 @@ -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 @@ -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;