Fix BrowserWindowFullScreenControllerTest.TestActivate on 10.11
[chromium-blink-merge.git] / courgette / crc.cc
blob28a0f9c0d8f1191d575b28c50419d29a4eb44d57
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "courgette/crc.h"
7 #ifdef COURGETTE_USE_CRC_LIB
8 # include "zlib.h"
9 #else
10 extern "C" {
11 # include "third_party/lzma_sdk/7zCrc.h"
13 #endif
15 #include "base/basictypes.h"
17 namespace courgette {
19 uint32 CalculateCrc(const uint8* buffer, size_t size) {
20 uint32 crc;
22 #ifdef COURGETTE_USE_CRC_LIB
23 // Calculate Crc by calling CRC method in zlib
24 crc = crc32(0, buffer, size);
25 #else
26 // Calculate Crc by calling CRC method in LZMA SDK
27 CrcGenerateTable();
28 crc = CrcCalc(buffer, size);
29 #endif
31 return ~crc;
34 } // namespace