mirror of
https://github.com/opencv/opencv.git
synced 2024-12-15 18:09:11 +08:00
85923c8f30
Update zlib-ng to 2.2.1 #26113 Release: https://github.com/zlib-ng/zlib-ng/releases/tag/2.2.1 ARM diagnostics patch: https://github.com/zlib-ng/zlib-ng/pull/1774 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
57 lines
2.2 KiB
C
57 lines
2.2 KiB
C
/* crc32_braid_comb.c -- compute the CRC-32 of a data stream
|
|
* Copyright (C) 1995-2022 Mark Adler
|
|
* For conditions of distribution and use, see copyright notice in zlib.h
|
|
*
|
|
* This interleaved implementation of a CRC makes use of pipelined multiple
|
|
* arithmetic-logic units, commonly found in modern CPU cores. It is due to
|
|
* Kadatch and Jenkins (2010). See doc/crc-doc.1.0.pdf in this distribution.
|
|
*/
|
|
|
|
#include "zutil.h"
|
|
#include "crc32_braid_p.h"
|
|
#include "crc32_braid_tbl.h"
|
|
#include "crc32_braid_comb_p.h"
|
|
|
|
/* ========================================================================= */
|
|
static uint32_t crc32_combine_(uint32_t crc1, uint32_t crc2, z_off64_t len2) {
|
|
return multmodp(x2nmodp(len2, 3), crc1) ^ crc2;
|
|
}
|
|
static uint32_t crc32_combine_gen_(z_off64_t len2) {
|
|
return x2nmodp(len2, 3);
|
|
}
|
|
static uint32_t crc32_combine_op_(uint32_t crc1, uint32_t crc2, const uint32_t op) {
|
|
return multmodp(op, crc1) ^ crc2;
|
|
}
|
|
|
|
/* ========================================================================= */
|
|
|
|
#ifdef ZLIB_COMPAT
|
|
unsigned long Z_EXPORT PREFIX(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off_t len2) {
|
|
return (unsigned long)crc32_combine_((uint32_t)crc1, (uint32_t)crc2, len2);
|
|
}
|
|
unsigned long Z_EXPORT PREFIX4(crc32_combine)(unsigned long crc1, unsigned long crc2, z_off64_t len2) {
|
|
return (unsigned long)crc32_combine_((uint32_t)crc1, (uint32_t)crc2, len2);
|
|
}
|
|
unsigned long Z_EXPORT PREFIX(crc32_combine_gen)(z_off_t len2) {
|
|
return crc32_combine_gen_(len2);
|
|
}
|
|
unsigned long Z_EXPORT PREFIX4(crc32_combine_gen)(z_off64_t len2) {
|
|
return crc32_combine_gen_(len2);
|
|
}
|
|
unsigned long Z_EXPORT PREFIX(crc32_combine_op)(unsigned long crc1, unsigned long crc2, const unsigned long op) {
|
|
return (unsigned long)crc32_combine_op_((uint32_t)crc1, (uint32_t)crc2, (uint32_t)op);
|
|
}
|
|
#else
|
|
uint32_t Z_EXPORT PREFIX4(crc32_combine)(uint32_t crc1, uint32_t crc2, z_off64_t len2) {
|
|
return crc32_combine_(crc1, crc2, len2);
|
|
}
|
|
uint32_t Z_EXPORT PREFIX(crc32_combine_gen)(z_off64_t len2) {
|
|
return crc32_combine_gen_(len2);
|
|
}
|
|
uint32_t Z_EXPORT PREFIX(crc32_combine_op)(uint32_t crc1, uint32_t crc2, const uint32_t op) {
|
|
return crc32_combine_op_(crc1, crc2, op);
|
|
}
|
|
#endif
|
|
|
|
/* ========================================================================= */
|