Skip to content

Commit

Permalink
Simplify debezium.encodeBigInt - pt. 2 (#756)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-artie authored Jun 25, 2024
1 parent 4ed52f8 commit 902c6bc
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions lib/debezium/decimal.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,7 @@ func encodeBigInt(value *big.Int) []byte {
twoComplement := new(big.Int).SetBytes(data)
twoComplement.Add(twoComplement, big.NewInt(1))

data = twoComplement.Bytes()
if data[0]&0x80 == 0 {
// 0xff is -1 in Java
// https://stackoverflow.com/questions/1677957/why-byte-b-byte-0xff-is-equals-to-integer-1
data = append([]byte{0xff}, data...)
}
return twoComplement.Bytes()
}

return data
Expand Down

0 comments on commit 902c6bc

Please sign in to comment.