mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2024-11-17 15:48:17 +01:00
Eliminated the stupid offset bug in interleaving. Hail to to the unit test.
This commit is contained in:
parent
45ec5ccd3e
commit
8d4f73429f
@ -14,8 +14,8 @@ const (
|
||||
numBitsPerComponent = 12
|
||||
modulo = 1 << numBitsPerComponent
|
||||
maxPositive = modulo / 2
|
||||
minValue = -1 << numBitsPerComponent
|
||||
maxValue = 1<<numBitsPerComponent - 1
|
||||
minValue = -1 << (numBitsPerComponent - 1)
|
||||
maxValue = 1<<(numBitsPerComponent-1) - 1
|
||||
)
|
||||
|
||||
type (
|
||||
@ -272,13 +272,13 @@ func BigMin(minz, maxz, zcode int64) int64 {
|
||||
pos := msb
|
||||
for m := int64(1) << msb; m != 0; m >>= 1 {
|
||||
var v uint8
|
||||
if zcode&m != 0 {
|
||||
if zcode&m == m {
|
||||
v = _100_
|
||||
}
|
||||
if minz&m != 0 {
|
||||
if minz&m == m {
|
||||
v |= _010_
|
||||
}
|
||||
if maxz&m != 0 {
|
||||
if maxz&m == m {
|
||||
v |= _001_
|
||||
}
|
||||
switch v {
|
||||
|
@ -181,7 +181,7 @@ func outsiders(zmin, zmax int64, fn func(int64)) {
|
||||
}
|
||||
|
||||
func TestBigMin(t *testing.T) {
|
||||
const tries = 10
|
||||
const tries = 20
|
||||
for i := 0; i < tries; i++ {
|
||||
x1 := rand.Intn(4000) - 2000
|
||||
y1 := rand.Intn(4000) - 2000
|
||||
|
Loading…
Reference in New Issue
Block a user