chiark
/
gitweb
/
~mdw
/
catacomb
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
fa17e5d
)
math/mpint.h (MP_TOINT): Convert MP digits to target type before shifting.
author
Mark Wooding
<mdw@distorted.org.uk>
Sun, 11 Sep 2016 13:24:34 +0000
(14:24 +0100)
committer
Mark Wooding
<mdw@distorted.org.uk>
Sun, 11 Sep 2016 13:24:34 +0000
(14:24 +0100)
Otherwise conversions to types wider than `mpw' never actually works.
math/mpint.h
patch
|
blob
|
blame
|
history
diff --git
a/math/mpint.h
b/math/mpint.h
index 1b0a7623db82d16d03b607d1b20dce71b625e027..6b733d1acb4613aa37ea9d3c49e9024921948af3 100644
(file)
--- a/
math/mpint.h
+++ b/
math/mpint.h
@@
-133,7
+133,7
@@
/* --- Do all the arithmetic in negative numbers --- */ \
\
while (_v < _vl && _max > 0) { \
- _i -=
*_v << _s;
\
+ _i -=
(type)*_v << _s;
\
_s += MPW_BITS; \
_v++; \
_max /= (mpd)MPW_MAX + 1; \