GNU bug report logs - #73814
[PATCH] maint: Drop unused sample/makecrc.c.

Previous Next

Package: gzip;

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.

Full log


View this message in rfc822 format

From: help-debbugs <at> gnu.org (GNU bug Tracking System)
To: Paul Eggert <eggert <at> cs.ucla.edu>
Cc: tracker <at> debbugs.gnu.org
Subject: bug#73814: closed ([PATCH] maint: Drop unused sample/makecrc.c.)
Date: Thu, 17 Oct 2024 20:49:02 +0000
[Message part 1 (text/plain, inline)]
Your message dated Thu, 17 Oct 2024 13:47:55 -0700
with message-id <0ede7156-994b-4f35-ac8d-13fa4533f60c <at> cs.ucla.edu>
and subject line Re: bug#73814: [PATCH] maint: Drop unused sample/makecrc.c.
has caused the debbugs.gnu.org bug report #73814,
regarding [PATCH] maint: Drop unused sample/makecrc.c.
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs <at> gnu.org.)


-- 
73814: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=73814
GNU Bug Tracking System
Contact help-debbugs <at> gnu.org with problems
[Message part 2 (message/rfc822, inline)]
From: Simon Josefsson <simon <at> josefsson.org>
To: bug-gzip <at> gnu.org
Subject: [PATCH] maint: Drop unused sample/makecrc.c.
Date: Tue, 15 Oct 2024 09:47:23 +0200
[Message part 3 (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)]
[Message part 6 (message/rfc822, inline)]
From: Paul Eggert <eggert <at> cs.ucla.edu>
To: Simon Josefsson <simon <at> josefsson.org>
Cc: 73814-done <at> debbugs.gnu.org
Subject: Re: bug#73814: [PATCH] maint: Drop unused sample/makecrc.c.
Date: Thu, 17 Oct 2024 13:47:55 -0700
Thanks, I installed that.


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.