Skip to content

Commit

Permalink
calculate signed min without throwing overflow warnings
Browse files Browse the repository at this point in the history
Signed-off-by: czechbol <[email protected]>
  • Loading branch information
czechbol committed Aug 30, 2024
1 parent 8ba2380 commit e6c5ee2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion analyzers/conversion_overflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ func parseIntType(intType string) (integer, error) {

if signed {
max = (1 << uint(intSize-1)) - 1
min = -int(max) - 1
min = -1 << (intSize - 1)
} else {
max = (1 << uint(intSize)) - 1
min = 0
Expand Down

0 comments on commit e6c5ee2

Please sign in to comment.