19th July 2019, 13:36
Nevermind what I wrote, your code is actually correct. The only problem was len/dist split in some cases. It looks like it depends on the last bits of the mask. If the mask ends with "11" the split is 5/11, if it ends with "00" the split is 2/14. I got the correct output for sample1 using that.
There might be other variations, but I think I can figure that out as I see more data. At least I have the correct core concept/code now.
Thank you very much for your help Shelwien. I hope I can bother you again if I have any more problems :D
Tested with multiple data and it works like a charm. Last 2 bits of the mask is indeed what determines the length bits. It is 2 (min value) + last 2 bits of the mask. So the split looks like this depending on last bits
"00" = 2 / 14
"01" = 3 / 13
"10" = 4 / 12
"11" = 5 / 11