libredwg
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [libredwg] LZ77 Compression


From: Dave Coventry
Subject: Re: [libredwg] LZ77 Compression
Date: Tue, 9 Oct 2012 10:34:46 +0200

Hi Till,

Thanks for the assistance.

I'm battling to understand it.

On 14 September 2012 21:51, Till Heuschmann <address@hidden> wrote:
> have you run the function step by step in a debugger?

Well, I've been following the code as best I can.

If I go to the copy_compressed_bytes function, I see copy_16(16);
Which is a #defined macro
 #define copy_16(offset) \
dst = copy_bytes_16(dst, src + offset);

Which points to the function:
char*
copy_bytes_16(char *dst, char *src)
{
  *(uint64_t*)dst = *(uint64_t*)(src + 8);
  *(uint64_t*)(dst + 8) = *(uint64_t*)src;
  return dst + 16;
}

I'm trying to emulate this in Pascal and am battling to understand the pointers.

If I look at the function copy_compressed_bytes(char *dst, char *src,
int length) (in decode_r2007.c, line appox 173), I see case 6 (line
202) which copies the next 6 bytes from the src to the dst arrays, the
6th first, then bytes 2 to 5 in their correct order, followed by the
first byte. Is this correct?

Case 7 copies the 8th byte, followed by the 7th, then 2, 3, 4, 5
followed by the first byte.

Case 8 just copies the 8 bytes without changing the order.

I'm a little confused. :+?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]