Add bounds check comment to dddToByte

This commit is contained in:
Tom Thorogood 2018-11-28 07:42:44 +10:30
parent 30d0133e57
commit 34d23c00e1
No known key found for this signature in database
GPG Key ID: 86C63CDA416C6D2F
1 changed files with 2 additions and 2 deletions

4
msg.go
View File

@ -556,12 +556,12 @@ func unpackTxt(msg []byte, off0 int) (ss []string, off int, err error) {
func isDigit(b byte) bool { return b >= '0' && b <= '9' }
func dddToByte(s []byte) byte {
_ = s[2]
_ = s[2] // bounds check hint to compiler; see golang.org/issue/14808
return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0'))
}
func dddStringToByte(s string) byte {
_ = s[2]
_ = s[2] // bounds check hint to compiler; see golang.org/issue/14808
return byte((s[0]-'0')*100 + (s[1]-'0')*10 + (s[2] - '0'))
}