diff options
author | Tomasz Kramkowski <tk@the-tk.com> | 2021-05-31 15:50:48 +0100 |
---|---|---|
committer | Tomasz Kramkowski <tk@the-tk.com> | 2021-05-31 17:38:33 +0100 |
commit | 13ceac75a8ed37ddc02df2b41627329c4da24b04 (patch) | |
tree | f3b8117821cc804282f02559f226af2275720d94 /common.c | |
parent | a1aec78f10f8821b5d6b29b664c40bb7f02758a5 (diff) | |
download | pack-13ceac75a8ed37ddc02df2b41627329c4da24b04.tar.gz pack-13ceac75a8ed37ddc02df2b41627329c4da24b04.tar.xz pack-13ceac75a8ed37ddc02df2b41627329c4da24b04.zip |
unpack: Fix negative signed integer unpacking calculation
Currently the calculation is just wrong since it effectively relies on
the widths of the signed and unsigned integer types and on
wrapping-on-assignment behavior. I have no idea why I wrote it like
this, it seems obviously wrong in retrospect.
The new behavior ensure that this succeeds in situations where type
widths are not correct.
The new code sets vals to the minimum possible two's complement signed
value (I just realised this code now assumes two's complement) and then
offsets it with the value part of the signed integer.
Diffstat (limited to 'common.c')
0 files changed, 0 insertions, 0 deletions