Skip to content

Commit

Permalink
additional updates
Browse files Browse the repository at this point in the history
  • Loading branch information
suyashkumar committed Nov 6, 2023
1 parent af0789d commit 431a059
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions read.go
Original file line number Diff line number Diff line change
Expand Up @@ -855,7 +855,8 @@ func (r *reader) moreToRead() bool {
return !r.rawReader.IsLimitExhausted()
}

// isNegativeIn2sComplement returns true if the most significant bit is 1.
// isNegativeIn2sComplement returns true if the most significant bit is 1 of the
// input unsigned integer. Panics if the input is not a Go unsigned integer.
func isNegativeIn2sComplement(input any) bool {
switch v := input.(type) {
case uint8:
Expand All @@ -864,6 +865,8 @@ func isNegativeIn2sComplement(input any) bool {
return (1 << 15 & v) > 0
case uint32:
return (1 << 31 & v) > 0
case uint64:
return (1 << 63 & v) > 0
}
return false
panic("isNegativeIn2sComplement expects some form of Go unsigned integer")
}

0 comments on commit 431a059

Please sign in to comment.