GNU bug report logs -
#73814
[PATCH] maint: Drop unused sample/makecrc.c.
Previous Next
Reported by: Simon Josefsson <simon <at> josefsson.org>
Date: Tue, 15 Oct 2024 07:48:02 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 73814 in the body.
You can then email your comments to 73814 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gzip <at> gnu.org
:
bug#73814
; Package
gzip
.
(Tue, 15 Oct 2024 07:48:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
Simon Josefsson <simon <at> josefsson.org>
:
New bug report received and forwarded. Copy sent to
bug-gzip <at> gnu.org
.
(Tue, 15 Oct 2024 07:48:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
[Message part 1 (text/plain, inline)]
Hi. The makecrc.c is not longer particulary relevant since gzip uses
the gnulib crc module. The code is nice to preserve, and could be moved
to gnulib eventually (possibly rewritten), but it will still be in gzip
git forever, so doesn't have to be in the release archive. What do you
think?
/Simon
[0001-maint-Drop-unused-sample-makecrc.c.patch (text/x-diff, inline)]
From 8d2f138b50bae43f1a208eb98ec4ebace41b0e53 Mon Sep 17 00:00:00 2001
From: Simon Josefsson <simon <at> josefsson.org>
Date: Tue, 15 Oct 2024 09:44:25 +0200
Subject: [PATCH] maint: Drop unused sample/makecrc.c.
---
Makefile.am | 2 +-
sample/makecrc.c | 61 ------------------------------------------------
2 files changed, 1 insertion(+), 62 deletions(-)
delete mode 100644 sample/makecrc.c
diff --git a/Makefile.am b/Makefile.am
index 1aaec82..c1fb1dd 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -47,7 +47,7 @@ EXTRA_DIST = $(ACINCLUDE_INPUTS) $(man_MANS) \
dist-check.mk \
algorithm.doc \
gunzip.in gzexe.in gzip.doc \
- revision.h sample/makecrc.c \
+ revision.h \
sample/ztouch sample/add.c sample/sub.c sample/zread.c sample/zfile \
tailor.h \
zcat.in zcmp.in zdiff.in \
diff --git a/sample/makecrc.c b/sample/makecrc.c
deleted file mode 100644
index bf789d3..0000000
--- a/sample/makecrc.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Not copyrighted 1990 Mark Adler */
-
-#include <config.h>
-#include <stdio.h>
-
-int
-main ()
-/*
- Generate a table for a byte-wise 32-bit CRC calculation on the polynomial:
- x^32+x^26+x^23+x^22+x^16+x^12+x^11+x^10+x^8+x^7+x^5+x^4+x^2+x+1.
-
- Polynomials over GF(2) are represented in binary, one bit per coefficient,
- with the lowest powers in the most significant bit. Then adding polynomials
- is just exclusive-or, and multiplying a polynomial by x is a right shift by
- one. If we call the above polynomial p, and represent a byte as the
- polynomial q, also with the lowest power in the most significant bit (so the
- byte 0xb1 is the polynomial x^7+x^3+x+1), then the CRC is (q*x^32) mod p,
- where a mod b means the remainder after dividing a by b.
-
- This calculation is done using the shift-register method of multiplying and
- taking the remainder. The register is initialized to zero, and for each
- incoming bit, x^32 is added mod p to the register if the bit is a one (where
- x^32 mod p is p+x^32 = x^26+...+1), and the register is multiplied mod p by
- x (which is shifting right by one and adding x^32 mod p if the bit shifted
- out is a one). We start with the highest power (least significant bit) of
- q and repeat for all eight bits of q.
-
- The table is simply the CRC of all possible eight bit values. This is all
- the information needed to generate CRC's on data a byte at a time for all
- combinations of CRC register values and incoming bytes. The table is
- written to stdout as 256 long hexadecimal values in C language format.
-*/
-{
- unsigned long c; /* crc shift register */
- unsigned long e; /* polynomial exclusive-or pattern */
- int i; /* counter for all possible eight bit values */
- int k; /* byte being shifted into crc apparatus */
-
- /* terms of polynomial defining this crc (except x^32): */
- static int p[] = {0,1,2,4,5,7,8,10,11,12,16,22,23,26};
-
- /* Make exclusive-or pattern from polynomial (0xedb88320) */
- e = 0;
- for (i = 0; i < sizeof(p)/sizeof(int); i++)
- e |= 1L << (31 - p[i]);
-
- /* Compute and print table of CRC's, five per line */
- printf(" 0x00000000L");
- for (i = 1; i < 256; i++)
- {
- c = i;
- /* The idea to initialize the register with the byte instead of
- * zero was stolen from Haruhiko Okumura's ar002
- */
- for (k = 8; k; k--)
- c = c & 1 ? (c >> 1) ^ e : c >> 1;
- printf(i % 5 ? ", 0x%08lxL" : ",\n 0x%08lxL", c);
- }
- putchar('\n');
- return 0;
-}
--
2.46.0
[signature.asc (application/pgp-signature, inline)]
Reply sent
to
Paul Eggert <eggert <at> cs.ucla.edu>
:
You have taken responsibility.
(Thu, 17 Oct 2024 20:49:02 GMT)
Full text and
rfc822 format available.
Notification sent
to
Simon Josefsson <simon <at> josefsson.org>
:
bug acknowledged by developer.
(Thu, 17 Oct 2024 20:49:02 GMT)
Full text and
rfc822 format available.
Message #10 received at 73814-done <at> debbugs.gnu.org (full text, mbox):
Thanks, I installed that.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Fri, 15 Nov 2024 12:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 216 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.