opencv

Форк
0
/
crc32_fold.c 
33 строки · 1.1 Кб
1
/* crc32_fold.c -- crc32 folding interface
2
 * Copyright (C) 2021 Nathan Moinvaziri
3
 * For conditions of distribution and use, see copyright notice in zlib.h
4
 */
5
#include "zbuild.h"
6
#include "functable.h"
7

8
#include "crc32_fold.h"
9

10
#include <limits.h>
11

12
Z_INTERNAL uint32_t crc32_fold_reset_c(crc32_fold *crc) {
13
    crc->value = CRC32_INITIAL_VALUE;
14
    return crc->value;
15
}
16

17
Z_INTERNAL void crc32_fold_copy_c(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len) {
18
    crc->value = functable.crc32(crc->value, src, len);
19
    memcpy(dst, src, len);
20
}
21

22
Z_INTERNAL void crc32_fold_c(crc32_fold *crc, const uint8_t *src, size_t len, uint32_t init_crc) {
23
    /* Note: while this is basically the same thing as the vanilla CRC function, we still need
24
     * a functable entry for it so that we can generically dispatch to this function with the
25
     * same arguments for the versions that _do_ do a folding CRC but we don't want a copy. The
26
     * init_crc is an unused argument in this context */
27
    Z_UNUSED(init_crc);
28
    crc->value = functable.crc32(crc->value, src, len);
29
}
30

31
Z_INTERNAL uint32_t crc32_fold_final_c(crc32_fold *crc) {
32
    return crc->value;
33
}
34

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.