-
-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move crc32 folding functions into functable.
- Loading branch information
Showing
18 changed files
with
153 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
/* crc32_fold.c -- crc32 folding interface | ||
* Copyright (C) 2021 Nathan Moinvaziri | ||
* For conditions of distribution and use, see copyright notice in zlib.h | ||
*/ | ||
#include "zbuild.h" | ||
#include "zutil.h" | ||
#include "functable.h" | ||
|
||
#include "crc32_fold.h" | ||
|
||
Z_INTERNAL uint32_t crc32_fold_reset_c(crc32_fold *crc) { | ||
crc->value = CRC32_INITIAL_VALUE; | ||
return crc->value; | ||
} | ||
|
||
Z_INTERNAL void crc32_fold_copy_c(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len) { | ||
crc->value = functable.crc32(crc->value, src, len); | ||
memcpy(dst, src, len); | ||
} | ||
|
||
Z_INTERNAL uint32_t crc32_fold_final_c(crc32_fold *crc) { | ||
return crc->value; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* crc32_fold.h -- crc32 folding interface | ||
* Copyright (C) 2021 Nathan Moinvaziri | ||
* For conditions of distribution and use, see copyright notice in zlib.h | ||
*/ | ||
#ifndef CRC32_FOLD_H_ | ||
#define CRC32_FOLD_H_ | ||
|
||
typedef struct crc32_fold_s { | ||
uint32_t ALIGNED_(16) fold[4 * 5]; | ||
uint32_t value; | ||
} crc32_fold; | ||
|
||
Z_INTERNAL uint32_t crc32_fold_reset_c(crc32_fold *crc); | ||
Z_INTERNAL void crc32_fold_copy_c(crc32_fold *crc, uint8_t *dst, const uint8_t *src, size_t len); | ||
Z_INTERNAL uint32_t crc32_fold_final_c(crc32_fold *crc); | ||
|
||
#endif |
Oops, something went wrong.