1 /***************************************************************************** 2 3 Copyright (c) 2011, 2015, Oracle and/or its affiliates. All Rights Reserved. 4 Copyright (c) 2016, 2018, MariaDB Corporation. 5 6 This program is free software; you can redistribute it and/or modify it under 7 the terms of the GNU General Public License as published by the Free Software 8 Foundation; version 2 of the License. 9 10 This program is distributed in the hope that it will be useful, but WITHOUT 11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12 FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along with 15 this program; if not, write to the Free Software Foundation, Inc., 16 51 Franklin Street, Fifth Floor, Boston, MA 02110-1335 USA 17 18 *****************************************************************************/ 19 20 /**************************************************//** 21 @file include/ut0crc32.h 22 CRC32 implementation 23 24 Created Aug 10, 2011 Vasil Dimov 25 *******************************************************/ 26 27 #ifndef ut0crc32_h 28 #define ut0crc32_h 29 30 #include "univ.i" 31 32 /********************************************************************//** 33 Initializes the data structures used by ut_crc32*(). Does not do any 34 allocations, would not hurt if called twice, but would be pointless. */ 35 void 36 ut_crc32_init(); 37 /*===========*/ 38 39 /********************************************************************//** 40 Calculates CRC32. 41 @param ptr - data over which to calculate CRC32. 42 @param len - data length in bytes. 43 @return CRC32 (CRC-32C, using the GF(2) primitive polynomial 0x11EDC6F41, 44 or 0x1EDC6F41 without the high-order bit) */ 45 typedef uint32_t (*ut_crc32_func_t)(const byte* ptr, ulint len); 46 47 /** Pointer to CRC32 calculation function. */ 48 extern ut_crc32_func_t ut_crc32; 49 50 /** Text description of CRC32 implementation */ 51 extern const char* ut_crc32_implementation; 52 53 #endif /* ut0crc32_h */ 54