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

BZip2Crc.cpp « Compress « 7zip « CPP - github.com/kornelski/7z.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 9639c7b7eb8ff7920c343ed7f49c5a75f8323f12 (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
27
// 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 (unsigned j = 0; j < 8; j++)
      r = (r << 1) ^ (kBZip2CrcPoly & ((UInt32)0 - (r >> 31)));
    Table[i] = r;
  }
}

static
class CBZip2CrcTableInit
{
public:
  CBZip2CrcTableInit() { CBZip2Crc::InitTable(); }
} g_BZip2CrcTableInit;