>  The game is to not change the size of R struct

As long as the size of the file is recorded somewhere, then you could use
this to have a varying granularity of line numbers. e.g.

file size	recorded accuracy
---------	-----------------
0..8191		exact
8192..16383	to within 2 lines
16384..24575	to within 3 lines
24576..32767	to within 4 lines
... etc

def encode_line(n, filesize)
  raise "oops" if n > filesize
  x = (filesize >> 13) + 1
  n / x
end

def decode_line(n, filesize)
  x = (filesize >> 13) + 1
  (n*x)..(n*x + x - 1)
end

You get the same lack of resolution in the current system. However, if the
file size is 20000 lines (say), then an error in line 17 could be in line
17, line 8209 or line 16401 - rather than line 15, 16 or 17.

Just a thought.

Regards,

Brian.