Delta Encoding - Sample C Code

Sample C Code

The following C code performs a simple form of delta encoding and decoding:

void delta_encode (char *buffer, const unsigned int length) { char delta = 0; char original; unsigned int i; for (i = 0; i < length; ++i) { original = buffer; buffer -= delta; delta = original; } } void delta_decode (char *buffer, const unsigned int length) { char delta = 0; unsigned int i; for (i = 0; i < length; ++i) { buffer += delta; delta = buffer; } }

Read more about this topic:  Delta Encoding

Famous quotes containing the words sample and/or code:

    All that a city will ever allow you is an angle on it—an oblique, indirect sample of what it contains, or what passes through it; a point of view.
    Peter Conrad (b. 1948)

    Faultless honesty is a sine qua non of business life. Not alone the honesty according to the moral code and the Bible. When I speak of honesty I refer to the small, hidden, evasive meannesses of our natures. I speak of the honesty of ourselves to ourselves.
    Alice Foote MacDougall (1867–1945)