Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 10:01:25

0001 /**********************************************************************
0002   Copyright(c) 2011-2016 Intel Corporation All rights reserved.
0003 
0004   Redistribution and use in source and binary forms, with or without
0005   modification, are permitted provided that the following conditions
0006   are met:
0007     * Redistributions of source code must retain the above copyright
0008       notice, this list of conditions and the following disclaimer.
0009     * Redistributions in binary form must reproduce the above copyright
0010       notice, this list of conditions and the following disclaimer in
0011       the documentation and/or other materials provided with the
0012       distribution.
0013     * Neither the name of Intel Corporation nor the names of its
0014       contributors may be used to endorse or promote products derived
0015       from this software without specific prior written permission.
0016 
0017   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
0018   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
0019   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
0020   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
0021   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
0022   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
0023   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
0024   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
0025   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
0026   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
0027   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
0028 **********************************************************************/
0029 
0030 
0031 /**
0032  *  @file  crc64.h
0033  *  @brief CRC64 functions.
0034  */
0035 
0036 
0037 #ifndef _CRC64_H_
0038 #define _CRC64_H_
0039 
0040 #include <stdint.h>
0041 
0042 #ifdef __cplusplus
0043 extern "C" {
0044 #endif
0045 
0046 
0047 /* Multi-binary functions */
0048 
0049 /**
0050  * @brief Generate CRC from ECMA-182 standard in reflected format, runs
0051  * appropriate version.
0052  *
0053  * This function determines what instruction sets are enabled and
0054  * selects the appropriate version at runtime.
0055  * @returns 64 bit CRC
0056  */
0057 uint64_t crc64_ecma_refl(
0058     uint64_t init_crc,        //!< initial CRC value, 64 bits
0059     const unsigned char *buf, //!< buffer to calculate CRC on
0060     uint64_t len              //!< buffer length in bytes (64-bit data)
0061     );
0062 
0063 /**
0064  * @brief Generate CRC from ECMA-182 standard in normal format, runs
0065  * appropriate version.
0066  *
0067  * This function determines what instruction sets are enabled and
0068  * selects the appropriate version at runtime.
0069  * @returns 64 bit CRC
0070  */
0071 uint64_t crc64_ecma_norm(
0072     uint64_t init_crc,        //!< initial CRC value, 64 bits
0073     const unsigned char *buf, //!< buffer to calculate CRC on
0074     uint64_t len              //!< buffer length in bytes (64-bit data)
0075     );
0076 
0077 /**
0078  * @brief Generate CRC from ISO standard in reflected format, runs
0079  * appropriate version.
0080  *
0081  * This function determines what instruction sets are enabled and
0082  * selects the appropriate version at runtime.
0083  * @returns 64 bit CRC
0084  */
0085 uint64_t crc64_iso_refl(
0086     uint64_t init_crc,        //!< initial CRC value, 64 bits
0087     const unsigned char *buf, //!< buffer to calculate CRC on
0088     uint64_t len              //!< buffer length in bytes (64-bit data)
0089     );
0090 
0091 /**
0092  * @brief Generate CRC from ISO standard in normal format, runs
0093  * appropriate version.
0094  *
0095  * This function determines what instruction sets are enabled and
0096  * selects the appropriate version at runtime.
0097  * @returns 64 bit CRC
0098  */
0099 uint64_t crc64_iso_norm(
0100     uint64_t init_crc,        //!< initial CRC value, 64 bits
0101     const unsigned char *buf, //!< buffer to calculate CRC on
0102     uint64_t len              //!< buffer length in bytes (64-bit data)
0103     );
0104 
0105 /**
0106  * @brief Generate CRC from "Jones" coefficients in reflected format, runs
0107  * appropriate version.
0108  *
0109  * This function determines what instruction sets are enabled and
0110  * selects the appropriate version at runtime.
0111  * @returns 64 bit CRC
0112  */
0113 uint64_t crc64_jones_refl(
0114     uint64_t init_crc,        //!< initial CRC value, 64 bits
0115     const unsigned char *buf, //!< buffer to calculate CRC on
0116     uint64_t len              //!< buffer length in bytes (64-bit data)
0117     );
0118 
0119 /**
0120  * @brief Generate CRC from "Jones" coefficients in normal format, runs
0121  * appropriate version.
0122  *
0123  * This function determines what instruction sets are enabled and
0124  * selects the appropriate version at runtime.
0125  * @returns 64 bit CRC
0126  */
0127 uint64_t crc64_jones_norm(
0128     uint64_t init_crc,        //!< initial CRC value, 64 bits
0129     const unsigned char *buf, //!< buffer to calculate CRC on
0130     uint64_t len              //!< buffer length in bytes (64-bit data)
0131     );
0132 
0133 /* Arch specific versions */
0134 
0135 /**
0136  * @brief Generate CRC from ECMA-182 standard in reflected format.
0137  * @requires SSE3, CLMUL
0138  *
0139  * @returns 64 bit CRC
0140  */
0141 
0142 uint64_t crc64_ecma_refl_by8(
0143     uint64_t init_crc,        //!< initial CRC value, 64 bits
0144     const unsigned char *buf, //!< buffer to calculate CRC on
0145     uint64_t len              //!< buffer length in bytes (64-bit data)
0146     );
0147 
0148 /**
0149  * @brief Generate CRC from ECMA-182 standard in normal format.
0150  * @requires SSE3, CLMUL
0151  *
0152  * @returns 64 bit CRC
0153  */
0154 
0155 uint64_t crc64_ecma_norm_by8(
0156     uint64_t init_crc,        //!< initial CRC value, 64 bits
0157     const unsigned char *buf, //!< buffer to calculate CRC on
0158     uint64_t len              //!< buffer length in bytes (64-bit data)
0159     );
0160 
0161 /**
0162  * @brief Generate CRC from ECMA-182 standard in reflected format, runs baseline version
0163  * @returns 64 bit CRC
0164  */
0165 uint64_t crc64_ecma_refl_base(
0166     uint64_t init_crc,        //!< initial CRC value, 64 bits
0167     const unsigned char *buf, //!< buffer to calculate CRC on
0168     uint64_t len              //!< buffer length in bytes (64-bit data)
0169     );
0170 
0171 /**
0172  * @brief Generate CRC from ECMA-182 standard in normal format, runs baseline version
0173  * @returns 64 bit CRC
0174  */
0175 uint64_t crc64_ecma_norm_base(
0176     uint64_t init_crc,        //!< initial CRC value, 64 bits
0177     const unsigned char *buf, //!< buffer to calculate CRC on
0178     uint64_t len              //!< buffer length in bytes (64-bit data)
0179     );
0180 
0181 /**
0182  * @brief Generate CRC from ISO standard in reflected format.
0183  * @requires SSE3, CLMUL
0184  *
0185  * @returns 64 bit CRC
0186  */
0187 
0188 uint64_t crc64_iso_refl_by8(
0189     uint64_t init_crc,        //!< initial CRC value, 64 bits
0190     const unsigned char *buf, //!< buffer to calculate CRC on
0191     uint64_t len              //!< buffer length in bytes (64-bit data)
0192     );
0193 
0194 /**
0195  * @brief Generate CRC from ISO standard in normal format.
0196  * @requires SSE3, CLMUL
0197  *
0198  * @returns 64 bit CRC
0199  */
0200 
0201 uint64_t crc64_iso_norm_by8(
0202     uint64_t init_crc,        //!< initial CRC value, 64 bits
0203     const unsigned char *buf, //!< buffer to calculate CRC on
0204     uint64_t len              //!< buffer length in bytes (64-bit data)
0205     );
0206 
0207 /**
0208  * @brief Generate CRC from ISO standard in reflected format, runs baseline version
0209  * @returns 64 bit CRC
0210  */
0211 uint64_t crc64_iso_refl_base(
0212     uint64_t init_crc,        //!< initial CRC value, 64 bits
0213     const unsigned char *buf, //!< buffer to calculate CRC on
0214     uint64_t len              //!< buffer length in bytes (64-bit data)
0215     );
0216 
0217 /**
0218  * @brief Generate CRC from ISO standard in normal format, runs baseline version
0219  * @returns 64 bit CRC
0220  */
0221 uint64_t crc64_iso_norm_base(
0222     uint64_t init_crc,        //!< initial CRC value, 64 bits
0223     const unsigned char *buf, //!< buffer to calculate CRC on
0224     uint64_t len              //!< buffer length in bytes (64-bit data)
0225     );
0226 
0227 /**
0228  * @brief Generate CRC from "Jones" coefficients in reflected format.
0229  * @requires SSE3, CLMUL
0230  *
0231  * @returns 64 bit CRC
0232  */
0233 
0234 uint64_t crc64_jones_refl_by8(
0235     uint64_t init_crc,        //!< initial CRC value, 64 bits
0236     const unsigned char *buf, //!< buffer to calculate CRC on
0237     uint64_t len              //!< buffer length in bytes (64-bit data)
0238     );
0239 
0240 /**
0241  * @brief Generate CRC from "Jones" coefficients in normal format.
0242  * @requires SSE3, CLMUL
0243  *
0244  * @returns 64 bit CRC
0245  */
0246 
0247 uint64_t crc64_jones_norm_by8(
0248     uint64_t init_crc,        //!< initial CRC value, 64 bits
0249     const unsigned char *buf, //!< buffer to calculate CRC on
0250     uint64_t len              //!< buffer length in bytes (64-bit data)
0251     );
0252 
0253 /**
0254  * @brief Generate CRC from "Jones" coefficients in reflected format, runs baseline version
0255  * @returns 64 bit CRC
0256  */
0257 uint64_t crc64_jones_refl_base(
0258     uint64_t init_crc,        //!< initial CRC value, 64 bits
0259     const unsigned char *buf, //!< buffer to calculate CRC on
0260     uint64_t len              //!< buffer length in bytes (64-bit data)
0261     );
0262 
0263 /**
0264  * @brief Generate CRC from "Jones" coefficients in normal format, runs baseline version
0265  * @returns 64 bit CRC
0266  */
0267 uint64_t crc64_jones_norm_base(
0268     uint64_t init_crc,        //!< initial CRC value, 64 bits
0269     const unsigned char *buf, //!< buffer to calculate CRC on
0270     uint64_t len              //!< buffer length in bytes (64-bit data)
0271     );
0272 
0273 #ifdef __cplusplus
0274 }
0275 #endif
0276 
0277 #endif // _CRC64_H_