diff --git a/common/coords.go b/common/coords.go index ed162aa..2ca3189 100644 --- a/common/coords.go +++ b/common/coords.go @@ -140,10 +140,22 @@ func TransformPlainToInterleaved(pos int64) int64 { return CoordToInterleaved(PlainToCoord(pos)) } -func TransformInterleavedPlain(pos int64) int64 { +func TransformInterleavedToPlain(pos int64) int64 { return CoordToPlain(InterleavedToCoord(pos)) } +func DecodeStringFromBytesToInterleaved(key []byte) (v int64, err error) { + if v, err = DecodeStringFromBytes(key); err != nil { + return + } + v = TransformPlainToInterleaved(v) + return +} + +func EncodeStringToBytesFromInterleaved(key int64) ([]byte, error) { + return EncodeStringToBytes(TransformInterleavedToPlain(key)) +} + func SelectKeySplitter(interleaved bool) KeySplitter { if interleaved { return InterleavedToCoord