diff options
author | rsc <devnull@localhost> | 2005-12-30 17:06:50 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2005-12-30 17:06:50 +0000 |
commit | 9e36143a34451aba972b157a53160f1badff9ceb (patch) | |
tree | 61d9e655f95c44129c3faa6dbd2b74cef9cd8249 /src/libmp | |
parent | af79ebc2b6faf92268193a43bd087dbf75840b41 (diff) | |
download | plan9port-9e36143a34451aba972b157a53160f1badff9ceb.tar.gz plan9port-9e36143a34451aba972b157a53160f1badff9ceb.tar.bz2 plan9port-9e36143a34451aba972b157a53160f1badff9ceb.zip |
fix shift
Diffstat (limited to 'src/libmp')
-rw-r--r-- | src/libmp/port/mptouv.c | 5 | ||||
-rw-r--r-- | 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; |