MCPcopy
hub / github.com/golang/geo / immediateParent

Method immediateParent

s2/cellid.go:183–186  ·  view source on GitHub ↗

immediateParent is cheaper than Parent, but assumes !ci.isFace().

()

Source from the content-addressed store, hash-verified

181
182// immediateParent is cheaper than Parent, but assumes !ci.isFace().
183func (ci CellID) immediateParent() CellID {
184 nlsb := CellID(ci.lsb() << 2)
185 return (ci & -nlsb) | nlsb
186}
187
188// isFace returns whether this is a top-level (face) cell.
189func (ci CellID) isFace() bool { return uint64(ci)&(lsbForLevel(0)-1) == 0 }

Callers 8

MaxTileMethod · 0.95
TestCapIntersectsCellFunction · 0.80
TestCellIDAllNeighborsFunction · 0.80
NormalizeMethod · 0.80
testIteratorMethodsFunction · 0.80
TestCellUnionFunction · 0.80

Calls 2

lsbMethod · 0.95
CellIDTypeAlias · 0.85

Tested by 6

TestCapIntersectsCellFunction · 0.64
TestCellIDAllNeighborsFunction · 0.64
testIteratorMethodsFunction · 0.64
TestCellUnionFunction · 0.64