aboutsummaryrefslogtreecommitdiff
path: root/util/cbfstool/lzma/C/Common/CRC.cpp
diff options
context:
space:
mode:
authorStefan Reinauer <reinauer@chromium.org>2012-10-30 14:02:45 -0700
committerStefan Reinauer <stefan.reinauer@coreboot.org>2012-11-12 18:35:52 +0100
commit2e200cde9a58a64f3df5f1c69dcdd57ef9452c3d (patch)
tree919607fc52473fbb54d587c2c4102f58328f13f2 /util/cbfstool/lzma/C/Common/CRC.cpp
parenta5b70676385d6b5da3d18f81042de4a1bb4cf0da (diff)
cbfstool: Update LZMA encoder to LZMA SDK 9.12
This removes almost all C++ code (except the wrapper) Change-Id: I0f84070e3b6dc57c98d49a53150a140479b3221f Signed-off-by: Stefan Reinauer <reinauer@google.com> Reviewed-on: http://review.coreboot.org/1799 Tested-by: build bot (Jenkins) Reviewed-by: Ronald G. Minnich <rminnich@gmail.com>
Diffstat (limited to 'util/cbfstool/lzma/C/Common/CRC.cpp')
-rw-r--r--util/cbfstool/lzma/C/Common/CRC.cpp61
1 files changed, 0 insertions, 61 deletions
diff --git a/util/cbfstool/lzma/C/Common/CRC.cpp b/util/cbfstool/lzma/C/Common/CRC.cpp
deleted file mode 100644
index de5d561def..0000000000
--- a/util/cbfstool/lzma/C/Common/CRC.cpp
+++ /dev/null
@@ -1,61 +0,0 @@
-// Common/CRC.cpp
-
-#include "StdAfx.h"
-
-#include "CRC.h"
-
-static const UInt32 kCRCPoly = 0xEDB88320;
-
-UInt32 CCRC::Table[256];
-
-void CCRC::InitTable()
-{
- for (UInt32 i = 0; i < 256; i++)
- {
- UInt32 r = i;
- for (int j = 0; j < 8; j++)
- if (r & 1)
- r = (r >> 1) ^ kCRCPoly;
- else
- r >>= 1;
- CCRC::Table[i] = r;
- }
-}
-
-class CCRCTableInit
-{
-public:
- CCRCTableInit() { CCRC::InitTable(); }
-} g_CRCTableInit;
-
-void CCRC::UpdateByte(Byte b)
-{
- _value = Table[((Byte)(_value)) ^ b] ^ (_value >> 8);
-}
-
-void CCRC::UpdateUInt16(UInt16 v)
-{
- UpdateByte(Byte(v));
- UpdateByte(Byte(v >> 8));
-}
-
-void CCRC::UpdateUInt32(UInt32 v)
-{
- for (int i = 0; i < 4; i++)
- UpdateByte((Byte)(v >> (8 * i)));
-}
-
-void CCRC::UpdateUInt64(UInt64 v)
-{
- for (int i = 0; i < 8; i++)
- UpdateByte((Byte)(v >> (8 * i)));
-}
-
-void CCRC::Update(const void *data, size_t size)
-{
- UInt32 v = _value;
- const Byte *p = (const Byte *)data;
- for (; size > 0 ; size--, p++)
- v = Table[((Byte)(v)) ^ *p] ^ (v >> 8);
- _value = v;
-}