Simplified code for naiv BigMin implementation.

This commit is contained in:
Sascha L. Teichmann 2014-09-01 18:44:56 +02:00
parent c096b8bbf1
commit 85741f3b0e

View File

@ -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
}
}