Changes
Page history
Reference example in match decoding
authored
Aug 23, 2019
by
Nico Bendlin
Show whitespace changes
Inline
Side-by-side
compression.md
View page @
bee1f1ae
...
@@ -63,11 +63,12 @@ The distance base is the current output position
...
@@ -63,11 +63,12 @@ The distance base is the current output position
(
`distance = ((code[0] << 4) & 0x0F00) | code[1]`
),
(
`distance = ((code[0] << 4) & 0x0F00) | code[1]`
),
therefore the maximum distance is 4095 octets.
therefore the maximum distance is 4095 octets.
On decoding length octets are copied to the output
position
,
On decoding length
count
octets are copied to the output,
starting from
initial
output position minus distance.
starting from
current
output position minus distance.
Please note that
source and destination can/will overlap
Please note that
this is not a memory copy, but a sequence
(copy
single octets
, neither use memcpy, nor
(copy
octet by octect - no 'optimizations'
, neither use memcpy, nor
[
memmove
](
https://en.cppreference.com/w/c/string/byte/memmove#Notes
)
).
[
memmove
](
https://en.cppreference.com/w/c/string/byte/memmove#Notes
)
).
See the example stream where a match generates 18 from 2 octects.
Please note that the distance value could be 0. This would result in
Please note that the distance value could be 0. This would result in
undefined behavior during decompression (if the implementation does
undefined behavior during decompression (if the implementation does
...
...
...
...