Moved ordering of two int64 to common/math.

This commit is contained in:
Sascha L. Teichmann 2015-07-26 16:40:50 +02:00
parent 8817094001
commit f6e5eb8510
4 changed files with 9 additions and 14 deletions

View File

@ -387,7 +387,7 @@ func (ldbs *LevelDBSession) interleavedSpatialQuery(
zmin, zmax := common.CoordToInterleaved(c1), common.CoordToInterleaved(c2)
// Should not be necessary.
zmin, zmax = order(zmin, zmax)
zmin, zmax = common.Order64(zmin, zmax)
var (
cub = common.Cuboid{P1: c1, P2: c2}
err error

View File

@ -1,12 +0,0 @@
// Copyright 2014, 2015 by Sascha L. Teichmann
// Use of this source code is governed by the MIT license
// that can be found in the LICENSE file.
package main
func order(a, b int64) (int64, int64) {
if a < b {
return a, b
}
return b, a
}

View File

@ -369,7 +369,7 @@ func (ss *SqliteSession) interleavedSpatialQuery(
defer globalLock.RUnlock()
zmin, zmax := common.CoordToInterleaved(c1), common.CoordToInterleaved(c2)
// Should not be necessary.
zmin, zmax = order(zmin, zmax)
zmin, zmax = common.Order64(zmin, zmax)
cub := common.Cuboid{P1: c1, P2: c2}
rangeStmt := ss.txStmt(ss.backend.rangeStmt)

View File

@ -58,3 +58,10 @@ func Clamp32f(x, a, b float32) float32 {
}
return x
}
func Order64(a, b int64) (int64, int64) {
if a < b {
return a, b
}
return b, a
}