Skip to content

Commit

Permalink
fix(utils/bytes): replace bitwise operators in read_varint()
Browse files Browse the repository at this point in the history
  • Loading branch information
dinhbx-smartosc committed Apr 16, 2024
1 parent 487a2b3 commit 3c1c51f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cardano/lib/ibc/utils/bytes.ak
Expand Up @@ -30,8 +30,8 @@ pub fn read_uvarint(bz: ByteArray, pos: Int) -> (Int, Int) {
/// read_varint() reads an encoded signed integer from r and returns it as an int64.
pub fn read_varint(r: ByteArray, pos: Int) -> (Int, Int) {
let (ux, updated_pos) = read_uvarint(r, pos)
let x = bits.shr(ux, 1)
if bits.band(ux, 1) != 0 {
let x = ux / 2
if ux % 2 != 0 {
(bits.bnot_for_int64(x), updated_pos)
} else {
(x, updated_pos)
Expand Down

0 comments on commit 3c1c51f

Please sign in to comment.