Adapted to recent changes of %build_linklib.
[AROS-Contrib.git] / FryingPan / framework / Generic / SumCRC.h
blobd73fde4002feb0920ec5ec31227dc4be19a111c5
1 /*
2 * Amiga Generic Set - set of libraries and includes to ease sw development for all Amiga platforms
3 * Copyright (C) 2001-2011 Tomasz Wiszkowski Tomasz.Wiszkowski at gmail.com.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 #ifndef _GENERIC_SUMCRC_H_
21 #define _GENERIC_SUMCRC_H_
23 #include "Types.h"
25 namespace GenNS
27 class SumCRC
29 public:
30 enum Polynominals
32 CRC_16_CCITT, // x^16 + x^12 + x^5 + 1
33 CRC_16_IBM, // x^16 + x^15 + x^2 + 1
34 CRC_32_MPEG2, // x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x + 1
35 CRC_32_IEEE, // as above
36 CRC_32_Castagnoli, // x^32 + x^28 + x^27 + x^26 + x^25 + x^23 + x^22 + x^20 + x^19 + x^18 + x^14 + x^13 + x^11 + x^10 + x^9 + x^8 + x^6 + 1
37 CRC_64_ISO, // x^64 + x^4 + x^3
38 CRC_64_ECMA, // no way.
41 protected:
42 uint64 crc;
43 uint64 lastWord;
45 int8 polySize;
46 uint64 polyWord;
47 protected:
48 void setPoly(uint64 poly, int8 size);
50 public:
51 SumCRC(Polynominals poly);
52 SumCRC(uint64 poly, int8 size);
53 virtual ~SumCRC();
55 virtual void Initialize();
56 virtual void Update(const uint8 *, uint32);
57 virtual void Finalize();
59 virtual uint64 GetSum();
63 #endif