diff options
author | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-10-26 18:11:06 +0200 |
---|---|---|
committer | Kostya Shishkov <kostya.shishkov@gmail.com> | 2021-10-26 18:11:06 +0200 |
commit | ffe6400ed1fffcac3dc114a38675b523efb0c916 (patch) | |
tree | a10a88ef27befbaca59f9776af37276e6927e091 /nihav-core/src | |
parent | e450979bd91939e6c729439ce84bd71bbd39d1f8 (diff) | |
download | nihav-ffe6400ed1fffcac3dc114a38675b523efb0c916.tar.gz |
core/intcode: fix unsigned to signed conversion function
Diffstat (limited to 'nihav-core/src')
-rw-r--r-- | nihav-core/src/io/intcode.rs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/nihav-core/src/io/intcode.rs b/nihav-core/src/io/intcode.rs index 55c8f85..f5d1282 100644 --- a/nihav-core/src/io/intcode.rs +++ b/nihav-core/src/io/intcode.rs @@ -142,7 +142,7 @@ fn read_gammap(br: &mut BitReader) -> BitReaderResult<u32> { } fn uval_to_sval0mp(uval: u32) -> i32 { - if (uval & 1) != 0 { -((uval >> 1) as i32) } + if (uval & 1) != 0 { -(((uval + 1) >> 1) as i32) } else { (uval >> 1) as i32 } } |