1 /***************************************************************************** 2 3 Copyright (c) 2011, 2011, Oracle and/or its affiliates. All Rights Reserved. 4 5 This program is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License, version 2.0, 7 as published by the Free Software Foundation. 8 9 This program is also distributed with certain software (including 10 but not limited to OpenSSL) that is licensed under separate terms, 11 as designated in a particular file or component or in included license 12 documentation. The authors of MySQL hereby grant you an additional 13 permission to link the program and your derivative works with the 14 separately licensed software that they have included with MySQL. 15 16 This program is distributed in the hope that it will be useful, 17 but WITHOUT ANY WARRANTY; without even the implied warranty of 18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 19 GNU General Public License, version 2.0, for more details. 20 21 You should have received a copy of the GNU General Public License along with 22 this program; if not, write to the Free Software Foundation, Inc., 23 51 Franklin Street, Suite 500, Boston, MA 02110-1335 USA 24 25 *****************************************************************************/ 26 27 /**************************************************//** 28 @file include/ut0crc32.h 29 CRC32 implementation 30 31 Created Aug 10, 2011 Vasil Dimov 32 *******************************************************/ 33 34 #ifndef ut0crc32_h 35 #define ut0crc32_h 36 37 #include "univ.i" 38 39 /********************************************************************//** 40 Initializes the data structures used by ut_crc32(). Does not do any 41 allocations, would not hurt if called twice, but would be pointless. */ 42 UNIV_INTERN 43 void 44 ut_crc32_init(); 45 /*===========*/ 46 47 /********************************************************************//** 48 Calculates CRC32. 49 @param ptr - data over which to calculate CRC32. 50 @param len - data length in bytes. 51 @return CRC32 (CRC-32C, using the GF(2) primitive polynomial 0x11EDC6F41, 52 or 0x1EDC6F41 without the high-order bit) */ 53 typedef ib_uint32_t (*ib_ut_crc32_t)(const byte* ptr, ulint len); 54 55 extern ib_ut_crc32_t ut_crc32; 56 57 extern bool ut_crc32_sse2_enabled; 58 59 #endif /* ut0crc32_h */ 60