Skip to content

Commit 7d4a0c5

Browse files
author
peterbclements
committed
Moved code to galois.h
1 parent 6a7aa61 commit 7d4a0c5

File tree

1 file changed

+29
-75
lines changed

1 file changed

+29
-75
lines changed

galois.cpp

+29-75
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,29 @@
1-
// This file is part of par2cmdline (a PAR 2.0 compatible file verification and
2-
// repair tool). See http://parchive.sourceforge.net for details of PAR 2.0.
3-
//
4-
// Copyright (c) 2003 Peter Brian Clements
5-
//
6-
// par2cmdline is free software; you can redistribute it and/or modify
7-
// it under the terms of the GNU General Public License as published by
8-
// the Free Software Foundation; either version 2 of the License, or
9-
// (at your option) any later version.
10-
//
11-
// par2cmdline is distributed in the hope that it will be useful,
12-
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13-
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14-
// GNU General Public License for more details.
15-
//
16-
// You should have received a copy of the GNU General Public License
17-
// along with this program; if not, write to the Free Software
18-
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19-
20-
#include "par2cmdline.h"
21-
22-
#ifdef _MSC_VER
23-
#ifdef _DEBUG
24-
#undef THIS_FILE
25-
static char THIS_FILE[]=__FILE__;
26-
#define new DEBUG_NEW
27-
#endif
28-
#endif
29-
30-
// Construct the log and antilog tables from the generator
31-
32-
GaloisTable::GaloisTable(void)
33-
{
34-
u32 b = 1;
35-
36-
for (u32 l=0; l<limit; l++)
37-
{
38-
log[b] = (ValueType)l;
39-
antilog[l] = (ValueType)b;
40-
41-
b <<= 1;
42-
if (b & count) b ^= generator;
43-
}
44-
45-
log[0] = (ValueType)count;
46-
antilog[count] = 0;
47-
}
48-
49-
// The one and only galois log/antilog table object
50-
GaloisTable Galois::table;
51-
52-
#ifdef LONGMULTIPLY
53-
GaloisLongMultiplyTable::GaloisLongMultiplyTable(void)
54-
{
55-
Galois *table = tables;
56-
57-
for (unsigned int i=0; i<bytes; i++)
58-
{
59-
for (unsigned int j=i; j<bytes; j++)
60-
{
61-
for (unsigned int ii=0; ii<256; ii++)
62-
{
63-
for (unsigned int jj=0; jj<256; jj++)
64-
{
65-
*table++ = Galois(ii << (8*i)) * Galois(jj << (8*j));
66-
}
67-
}
68-
}
69-
}
70-
}
71-
72-
GaloisLongMultiplyTable::~GaloisLongMultiplyTable(void)
73-
{
74-
}
75-
#endif
1+
// This file is part of par2cmdline (a PAR 2.0 compatible file verification and
2+
// repair tool). See http://parchive.sourceforge.net for details of PAR 2.0.
3+
//
4+
// Copyright (c) 2003 Peter Brian Clements
5+
//
6+
// par2cmdline is free software; you can redistribute it and/or modify
7+
// it under the terms of the GNU General Public License as published by
8+
// the Free Software Foundation; either version 2 of the License, or
9+
// (at your option) any later version.
10+
//
11+
// par2cmdline is distributed in the hope that it will be useful,
12+
// but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
// GNU General Public License for more details.
15+
//
16+
// You should have received a copy of the GNU General Public License
17+
// along with this program; if not, write to the Free Software
18+
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19+
20+
#include "par2cmdline.h"
21+
22+
#ifdef _MSC_VER
23+
#ifdef _DEBUG
24+
#undef THIS_FILE
25+
static char THIS_FILE[]=__FILE__;
26+
#define new DEBUG_NEW
27+
#endif
28+
#endif
29+

0 commit comments

Comments
 (0)