Welcome to mirror list, hosted at ThFree Co, Russian Federation.

BZip2CRC.cpp « BZip2 « Compress « 7zip - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: d3ca5e1503f01878a39995730ec260a42bee3311 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// BZip2CRC.cpp

#include "StdAfx.h"

#include "BZip2CRC.h"

UInt32 CBZip2CRC::Table[256];

static const UInt32 kBZip2CRCPoly = 0x04c11db7;  /* AUTODIN II, Ethernet, & FDDI */

void CBZip2CRC::InitTable()
{
  for (UInt32 i = 0; i < 256; i++)
  {
    UInt32 r = (i << 24);
    for (int j = 8; j > 0; j--)
      r = (r & 0x80000000) ? ((r << 1) ^ kBZip2CRCPoly) : (r << 1);
    Table[i] = r;
  }
}

class CBZip2CRCTableInit
{
public:
  CBZip2CRCTableInit() { CBZip2CRC::InitTable(); }
} g_CRCTableInit;