mirror of
https://github.com/fosslinux/live-bootstrap.git
synced 2026-03-17 16:55:25 +01:00
gzip: Regenerate crc table in util.c using makecrc
This commit is contained in:
parent
87601931b2
commit
247b2a2a89
6 changed files with 123 additions and 14 deletions
31
sysa/gzip-1.2.4/patches/makecrc-write-to-file.patch
Normal file
31
sysa/gzip-1.2.4/patches/makecrc-write-to-file.patch
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
SPDX-FileCopyrightText: 2023 Paul Dersey <pdersey@gmail.com>
|
||||
|
||||
SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
Modify makecrc so that it outputs C code to a file that
|
||||
can be appended to util.c
|
||||
|
||||
--- sample/makecrc.c
|
||||
+++ sample/makecrc.c
|
||||
@@ -47,7 +47,9 @@ main()
|
||||
e |= 1L << (31 - p[i]);
|
||||
|
||||
/* Compute and print table of CRC's, five per line */
|
||||
- printf(" 0x00000000L");
|
||||
+ FILE *output = fopen("crc.c", "w");
|
||||
+ fprintf(output, "ulg crc_32_tab[] = {\n");
|
||||
+ fprintf(output," 0x00000000L");
|
||||
for (i = 1; i < 256; i++)
|
||||
{
|
||||
c = i;
|
||||
@@ -56,8 +58,8 @@ main()
|
||||
*/
|
||||
for (k = 8; k; k--)
|
||||
c = c & 1 ? (c >> 1) ^ e : c >> 1;
|
||||
- printf(i % 5 ? ", 0x%08lxL" : ",\n 0x%08lxL", c);
|
||||
+ fprintf(output, i % 5 ? ", 0x%08lxL" : ",\n 0x%08lxL", c);
|
||||
}
|
||||
- putchar('\n');
|
||||
+ fprintf(output,"\n};\n");
|
||||
return 0;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue