summaryrefslogtreecommitdiffstats
path: root/third_party/lzma_sdk/7zCrc.c
diff options
context:
space:
mode:
authorinitial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-27 00:38:33 +0000
committerinitial.commit <initial.commit@0039d316-1c4b-4281-b951-d872f2087c98>2008-07-27 00:38:33 +0000
commit584cd5cbd7be997400ccb8db24ae5410b0b88117 (patch)
tree083e5f1f48d019e0f07b96fef7179483df53c823 /third_party/lzma_sdk/7zCrc.c
parentf5b16fed647e941aa66933178da85db2860d639b (diff)
downloadchromium_src-584cd5cbd7be997400ccb8db24ae5410b0b88117.zip
chromium_src-584cd5cbd7be997400ccb8db24ae5410b0b88117.tar.gz
chromium_src-584cd5cbd7be997400ccb8db24ae5410b0b88117.tar.bz2
Add third_party to the repository.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/lzma_sdk/7zCrc.c')
-rw-r--r--third_party/lzma_sdk/7zCrc.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/third_party/lzma_sdk/7zCrc.c b/third_party/lzma_sdk/7zCrc.c
new file mode 100644
index 0000000..61050dd
--- /dev/null
+++ b/third_party/lzma_sdk/7zCrc.c
@@ -0,0 +1,32 @@
+/* 7zCrc.c */
+
+#include "7zCrc.h"
+
+#define kCrcPoly 0xEDB88320
+UInt32 g_CrcTable[256];
+
+void MY_FAST_CALL CrcGenerateTable()
+{
+ UInt32 i;
+ for (i = 0; i < 256; i++)
+ {
+ UInt32 r = i;
+ int j;
+ for (j = 0; j < 8; j++)
+ r = (r >> 1) ^ (kCrcPoly & ~((r & 1) - 1));
+ g_CrcTable[i] = r;
+ }
+}
+
+UInt32 MY_FAST_CALL CrcUpdate(UInt32 v, const void *data, size_t size)
+{
+ const Byte *p = (const Byte *)data;
+ for (; size > 0 ; size--, p++)
+ v = CRC_UPDATE_BYTE(v, *p);
+ return v;
+}
+
+UInt32 MY_FAST_CALL CrcCalc(const void *data, size_t size)
+{
+ return CrcUpdate(CRC_INIT_VAL, data, size) ^ 0xFFFFFFFF;
+}