Skip to content

Commit f13cb10

Browse files
authored
Merge pull request #118 from jmr/cell-id-from-string
CellIDFromString: Remove no-op byte < 0 check
2 parents 1e303e5 + 070ebca commit f13cb10

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

s2/cellid.go

+3-2
Original file line numberDiff line numberDiff line change
@@ -355,8 +355,9 @@ func CellIDFromString(s string) CellID {
355355
}
356356
id := CellIDFromFace(face)
357357
for i := 2; i < len(s); i++ {
358-
childPos := s[i] - '0'
359-
if childPos < 0 || childPos > 3 {
358+
var childPos byte = s[i] - '0'
359+
// Bytes are non-negative.
360+
if childPos > 3 {
360361
return CellID(0)
361362
}
362363
id = id.Children()[childPos]

0 commit comments

Comments
 (0)