Skip to content

Commit

Permalink
encode positive int/int64 as uint/uint64, fixes #7
Browse files Browse the repository at this point in the history
  • Loading branch information
deltics committed Nov 16, 2023
1 parent a309633 commit bc63f16
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,6 @@

# Go workspace file
go.work

# vscode settings
.vscode
4 changes: 2 additions & 2 deletions encoder.int.family.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func (enc Encoder) EncodeInt64(i int64) error {
return enc.Write(uint32(i))

default:
_ = enc.Write(typeInt64)
_ = enc.Write(typeUint64) // keeps sonarcloud happy by not duplicating the case for < MinInt32 (positive int64/uint64 are identical)
return enc.Write(i)
}
}
Expand Down Expand Up @@ -271,7 +271,7 @@ func (enc Encoder) EncodeInt(i int) error {
return enc.Write(uint32(i))

default:
_ = enc.Write(typeInt64)
_ = enc.Write(typeUint64) // keeps sonarcloud happy by not duplicating the case for < MinInt32 (positive int64/uint64 are identical)
return enc.Write(int64(i))
}
}
Expand Down

0 comments on commit bc63f16

Please sign in to comment.