Skip to content

Instantly share code, notes, and snippets.

@davidreynolds
Created June 30, 2012 20:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save davidreynolds/3025367 to your computer and use it in GitHub Desktop.
Save davidreynolds/3025367 to your computer and use it in GitHub Desktop.
void encode(void)
{
...
while (r < bufferend) {
f1 = (F <= bufferend - r) ? F : bufferend - r;
x = 0; y = 1; c = buffer[r];
for (i = r - 1; i <= s; i--)
if (buffer[i] == c) {
for (j = 1; j < f1; j++)
if (buffer[i + j] != buffer[r + j]) break;
if (j < y) {
x = i; y = j;
}
}
...
}
...
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment