"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "C/HuffEnc.c" between
p7zip_15.14.1_src_all.tar.gz and p7zip_16.02_src_all.tar.gz

About: p7zip is a command-line file archiver with a high compression ratio (a port of the Windows program 7za.exe).

HuffEnc.c  (p7zip_15.14.1_src_all):HuffEnc.c  (p7zip_16.02_src_all)
/* HuffEnc.c -- functions for Huffman encoding /* HuffEnc.c -- functions for Huffman encoding
2009-09-02 : Igor Pavlov : Public domain */ 2016-05-16 : Igor Pavlov : Public domain */
#include "Precomp.h" #include "Precomp.h"
#include "HuffEnc.h" #include "HuffEnc.h"
#include "Sort.h" #include "Sort.h"
#define kMaxLen 16 #define kMaxLen 16
#define NUM_BITS 10 #define NUM_BITS 10
#define MASK ((1 << NUM_BITS) - 1) #define MASK ((1 << NUM_BITS) - 1)
skipping to change at line 124 skipping to change at line 124
for (len = maxLen - 1; lenCounters[len] == 0; len--); for (len = maxLen - 1; lenCounters[len] == 0; len--);
lenCounters[len]--; lenCounters[len]--;
lenCounters[len + 1] += 2; lenCounters[len + 1] += 2;
} }
{ {
UInt32 len; UInt32 len;
i = 0; i = 0;
for (len = maxLen; len != 0; len--) for (len = maxLen; len != 0; len--)
{ {
UInt32 num; UInt32 k;
for (num = lenCounters[len]; num != 0; num--) for (k = lenCounters[len]; k != 0; k--)
lens[p[i++] & MASK] = (Byte)len; lens[p[i++] & MASK] = (Byte)len;
} }
} }
{ {
UInt32 nextCodes[kMaxLen + 1]; UInt32 nextCodes[kMaxLen + 1];
{ {
UInt32 code = 0; UInt32 code = 0;
UInt32 len; UInt32 len;
for (len = 1; len <= kMaxLen; len++) for (len = 1; len <= kMaxLen; len++)
nextCodes[len] = code = (code + lenCounters[len - 1]) << 1; nextCodes[len] = code = (code + lenCounters[len - 1]) << 1;
} }
/* if (code + lenCounters[kMaxLen] - 1 != (1 << kMaxLen) - 1) throw 1; * / /* if (code + lenCounters[kMaxLen] - 1 != (1 << kMaxLen) - 1) throw 1; * /
{ {
UInt32 i; UInt32 k;
for (i = 0; i < numSymbols; i++) for (k = 0; k < numSymbols; k++)
p[i] = nextCodes[lens[i]]++; p[k] = nextCodes[lens[k]]++;
} }
} }
} }
} }
} }
 End of changes. 3 change blocks. 
6 lines changed or deleted 6 lines changed or added

Home  |  About  |  All  |  Newest  |  Fossies Dox  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTPS