+ */\r
+\r
+ const Byte *lim = cur + lenLimit;\r
+ son[_cyclicBufferPos] = curMatch;\r
+ do\r
+ {\r
+ UInt32 delta = pos - curMatch;\r
+ if (delta >= _cyclicBufferSize)\r
+ break;\r
+ {\r
+ ptrdiff_t diff;\r
+ curMatch = son[_cyclicBufferPos - delta + ((delta > _cyclicBufferPos) ? _cyclicBufferSize : 0)];\r
+ diff = (ptrdiff_t)0 - delta;\r
+ if (cur[maxLen] == cur[maxLen + diff])\r
+ {\r
+ const Byte *c = cur;\r
+ while (*c == c[diff])\r
+ {\r
+ if (++c == lim)\r
+ {\r
+ distances[0] = (UInt32)(lim - cur);\r
+ distances[1] = delta - 1;\r
+ return distances + 2;\r
+ }\r
+ }\r
+ {\r
+ unsigned len = (unsigned)(c - cur);\r
+ if (maxLen < len)\r
+ {\r
+ maxLen = len;\r
+ distances[0] = (UInt32)len;\r
+ distances[1] = delta - 1;\r
+ distances += 2;\r
+ }\r
+ }\r
+ }\r
+ }\r
+ }\r
+ while (--cutValue);\r
+\r
+ return distances;\r