From 85741f3b0e701ad54c2e4f9a122b9ae2cf24c59b Mon Sep 17 00:00:00 2001 From: "Sascha L. Teichmann" Date: Mon, 1 Sep 2014 18:44:56 +0200 Subject: [PATCH] Simplified code for naiv BigMin implementation. --- common/coords.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/common/coords.go b/common/coords.go index 2aa95f0..408bc25 100644 --- a/common/coords.go +++ b/common/coords.go @@ -229,15 +229,17 @@ func TranscodeInterleavedToPlain(key []byte) ([]byte, error) { // For correctness checks only. func NaiveBigMin(minz, maxz, zcode int64) int64 { - c1, c2 := InterleavedToCoord(minz), InterleavedToCoord(maxz) + var ( + c1 = InterleavedToCoord(minz) + c2 = InterleavedToCoord(maxz) + cand = minz + c Coord + ) - cand := minz - - for x := c1.X; x <= c2.X; x++ { - for y := c1.Y; y <= c2.Y; y++ { - for z := c1.Z; z <= c2.Z; z++ { - z := CoordToInterleaved(Coord{X: x, Y: y, Z: z}) - if z > zcode && z < cand { + for c.X = c1.X; c.X <= c2.X; c.X++ { + for c.Y = c1.Y; c.Y <= c2.Y; c.Y++ { + for c.Z = c1.Z; c.Z <= c2.Z; c.Z++ { + if z := CoordToInterleaved(c); z > zcode && z < cand { cand = z } }