summaryrefslogtreecommitdiffstats
path: root/mpi/mpi.h
diff options
context:
space:
mode:
authorKaz Kylheku <kaz@kylheku.com>2017-06-14 22:02:11 -0700
committerKaz Kylheku <kaz@kylheku.com>2017-06-14 22:02:11 -0700
commitd8a8c64b0b15bfbe1af29d3905325037135edc00 (patch)
tree0c57aa9d68c365abd1053f997e978e8970caf3b1 /mpi/mpi.h
parentbddc5f5c9981a3dd1bb04fb35a50bcccb4a08d39 (diff)
downloadtxr-d8a8c64b0b15bfbe1af29d3905325037135edc00.tar.gz
txr-d8a8c64b0b15bfbe1af29d3905325037135edc00.tar.bz2
txr-d8a8c64b0b15bfbe1af29d3905325037135edc00.zip
bugfix: sign-extend broken for bignums.
* arith.c (sign_extend): After taking the two's complement which works at the granularity of digits, not the exact number of bits, we must truncate the number to the exact number of bits before negating. Otherwise we end up with an excessively large value. For instance if a bignum like #x80... is sign extended tightly to the upper 1 bit, the resulting value is something like #-xFFFF80..., rather than #x-80... as it should be. There are extra 1 bits padding up to the bignum digit. These must be chopped away.
Diffstat (limited to 'mpi/mpi.h')
0 files changed, 0 insertions, 0 deletions