mirror of
https://bitbucket.org/s_l_teichmann/mtsatellite
synced 2025-01-11 09:20:17 +01:00
Silence a few golint warnings.
This commit is contained in:
parent
9d1b0cc7c6
commit
1baf9f9dee
@ -90,7 +90,7 @@ func MaxCoord(a, b Coord) Coord {
|
||||
Z: maxComponent(a.Z, b.Z)}
|
||||
}
|
||||
|
||||
// Constructs a database key out of byte slice.
|
||||
// DecodeStringFromBytes constructs a database key out of byte slice.
|
||||
func DecodeStringFromBytes(key []byte) (pos int64, err error) {
|
||||
return strconv.ParseInt(string(key), 10, 64)
|
||||
}
|
||||
@ -99,7 +99,7 @@ func StringToBytes(key int64) []byte {
|
||||
return []byte(strconv.FormatInt(key, 10))
|
||||
}
|
||||
|
||||
// Encode a block pos to byte slice.
|
||||
// EncodeStringToBytes encodes a block pos to byte slice.
|
||||
func EncodeStringToBytes(key int64) ([]byte, error) {
|
||||
return StringToBytes(key), nil
|
||||
}
|
||||
@ -230,22 +230,22 @@ func IdentityTranscoder(key []byte) ([]byte, error) {
|
||||
}
|
||||
|
||||
func TranscodePlainToInterleaved(key []byte) ([]byte, error) {
|
||||
if pos, err := DecodeStringFromBytesToInterleaved(key); err != nil {
|
||||
pos, err := DecodeStringFromBytesToInterleaved(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return EncodeToBigEndian(pos)
|
||||
}
|
||||
return EncodeToBigEndian(pos)
|
||||
}
|
||||
|
||||
func TranscodeInterleavedToPlain(key []byte) ([]byte, error) {
|
||||
if pos, err := DecodeFromBigEndian(key); err != nil {
|
||||
pos, err := DecodeFromBigEndian(key)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else {
|
||||
return EncodeStringToBytes(TransformInterleavedToPlain(pos))
|
||||
}
|
||||
return EncodeStringToBytes(TransformInterleavedToPlain(pos))
|
||||
}
|
||||
|
||||
// For correctness checks only.
|
||||
// NaiveBigMin is for correctness checks of BigMin only.
|
||||
func NaiveBigMin(minz, maxz, zcode int64) int64 {
|
||||
var (
|
||||
c1 = InterleavedToCoord(minz)
|
||||
|
Loading…
Reference in New Issue
Block a user