@@ -336,24 +336,24 @@ func (c *coverer) coveringInternal(region Region) {
336336// newCoverer returns an instance of coverer.
337337func (rc * RegionCoverer ) newCoverer () * coverer {
338338 return & coverer {
339- minLevel : max ( 0 , min ( MaxLevel , rc . MinLevel ) ),
340- MaxLevel : max ( 0 , min ( MaxLevel , rc . MaxLevel ) ),
341- levelMod : max ( 1 , min ( 3 , rc . LevelMod ) ),
339+ minLevel : clampInt ( rc . MinLevel , 0 , MaxLevel ),
340+ MaxLevel : clampInt ( rc . MaxLevel , 0 , MaxLevel ),
341+ levelMod : clampInt ( rc . LevelMod , 1 , 3 ),
342342 maxCells : rc .MaxCells ,
343343 }
344344}
345345
346346// Covering returns a CellUnion that covers the given region and satisfies the various restrictions.
347347func (rc * RegionCoverer ) Covering (region Region ) CellUnion {
348348 covering := rc .CellUnion (region )
349- covering .Denormalize (max ( 0 , min ( MaxLevel , rc .MinLevel )), max ( 1 , min ( 3 , rc . LevelMod ) ))
349+ covering .Denormalize (clampInt ( rc . MinLevel , 0 , MaxLevel ), clampInt ( rc .LevelMod , 1 , 3 ))
350350 return covering
351351}
352352
353353// InteriorCovering returns a CellUnion that is contained within the given region and satisfies the various restrictions.
354354func (rc * RegionCoverer ) InteriorCovering (region Region ) CellUnion {
355355 intCovering := rc .InteriorCellUnion (region )
356- intCovering .Denormalize (max ( 0 , min ( MaxLevel , rc .MinLevel )), max ( 1 , min ( 3 , rc . LevelMod ) ))
356+ intCovering .Denormalize (clampInt ( rc . MinLevel , 0 , MaxLevel ), clampInt ( rc .LevelMod , 1 , 3 ))
357357 return intCovering
358358}
359359
0 commit comments