43
44
export function toLength(lineCount: number, columnCount: number): Length {
45
>
// llllllllllllllllllllllllllcccccccccccccccccccccccccc (52 bits)
length.ts
46
>
// line count (26 bits) column count (26 bits)
47
>
48
>
// If there is no overflow (all values/sums below 2^26 = 67108864),
49
>
// we have `toLength(lns1, cols1) + toLength(lns2, cols2) = toLength(lns1 + lns2, cols1 + cols2)`.
50
>
51
>
// eslint-disable-next-line local/code-no-any-casts, @typescript-eslint/no-explicit-any
52
>
return (lineCount * factor + columnCount) as any as Length;
53
>
}
54
55
export function lengthToObj(length: Length): TextLength {