Skip to content

Commit 070ebca

Browse files
committed
CellIDFromString: Remove no-op byte < 0 check
1 parent 6188549 commit 070ebca

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)