public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: John Reiser <jreiser@BitWagon.com>
To: Matt Mackall <mpm@selenic.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: [PATCH 5/7] inflate pt1: cleanup Huffman table code
Date: Fri, 24 Feb 2006 13:52:05 -0800	[thread overview]
Message-ID: <43FF8005.5070700@BitWagon.com> (raw)
In-Reply-To: <6.399206195@selenic.com>

> Index: 2.6.16-rc4-inflate/lib/inflate.c
> ===================================================================
> --- 2.6.16-rc4-inflate.orig/lib/inflate.c	2006-02-22 17:16:07.000000000 -0600
> +++ 2.6.16-rc4-inflate/lib/inflate.c	2006-02-22 17:16:08.000000000 -0600
> @@ -117,12 +117,12 @@
>     an unused code.  If a code with e == 99 is looked up, this implies an
>     error in the data. */
>  struct huft {
> -	u8 e;			/* number of extra bits or operation */
> -	u8 b;			/* number of bits in this code or subcode */
>  	union {
> -		u16 n;		/* literal, length base, or distance base */
> -		struct huft *t;	/* pointer to next level of table */
> -	} v;
> +		u16 val; /* literal, length base, or distance base */
> +		struct huft *next; /* pointer to next level of table */
> +	};
> +	u8 extra; /* number of extra bits or operation */
> +	u8 bits; /* number of bits in this code or subcode */
>  };

How aggressive do you want to be?  About 3.7 years ago in
http://freshmeat.net/projects/gzip_x86/  I published:
-----
typedef unsigned short huft_ndx;  /* index>>1 */
struct huft {
  uch e;                /* number of extra bits or operation */
  uch b;                /* number of bits in this code or subcode */
  union {
    ush n;              /* literal, length base, or distance base */
    huft_ndx t;         /* index>>1 of next level of table */
  } v;
};
-----
which makes 4==sizeof(struct huft) and enables manipulation by 32-bit
fetch, exposing 'e' [extra] and 'b' [bits] in x86 byte registers
for fewer shift-and-mask operations.  The struct huft can be managed
as a stack of maximum length 1014.

-- 

  reply	other threads:[~2006-02-24 21:52 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <0.399206195@selenic.com>
2006-02-24 20:12 ` [PATCH 4/7] inflate pt1: start moving globals into iostate Matt Mackall
2006-02-24 20:12 ` [PATCH 1/7] inflate pt1: lindent and manual formatting changes Matt Mackall
2006-02-24 20:12 ` [PATCH 2/7] inflate pt1: kill legacy bits Matt Mackall
2006-02-24 20:12 ` [PATCH 3/7] inflate pt1: clean up input logic Matt Mackall
2006-02-24 22:19   ` Russell King
2006-02-25  6:51     ` Matt Mackall
2006-02-25  8:49       ` Russell King
2006-02-25  8:55         ` Russell King
2006-02-25  9:04           ` Andrew Morton
2006-02-25  9:09             ` Russell King
2006-02-25 14:54         ` Matt Mackall
2006-02-25 18:05           ` Russell King
2006-02-25 21:04             ` Matt Mackall
2006-02-25 21:22               ` Russell King
2006-02-25 21:47                 ` Matt Mackall
2006-02-25 21:58                   ` Russell King
2006-02-25 22:37                     ` Matt Mackall
2006-02-25 22:57                       ` Russell King
2006-02-27  1:18                         ` Johannes Stezenbach
2006-02-27  8:32                           ` Russell King
2006-02-27 12:07                             ` Johannes Stezenbach
2006-02-27 15:47                               ` Russell King
2006-02-27  9:06                         ` Matt Mackall
2006-02-25 22:25                   ` John Reiser
2006-03-07 23:26                 ` H. Peter Anvin
2006-03-10 18:55                   ` Matt Mackall
2006-02-24 20:12 ` [PATCH 7/7] inflate pt1: eliminate memzero usage Matt Mackall
2006-02-24 20:12 ` [PATCH 5/7] inflate pt1: cleanup Huffman table code Matt Mackall
2006-02-24 21:52   ` John Reiser [this message]
2006-02-24 22:06     ` Matt Mackall
2006-02-24 20:12 ` [PATCH 6/7] inflate pt1: internalize CRC calculation, cleanup table calculation Matt Mackall

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=43FF8005.5070700@BitWagon.com \
    --to=jreiser@bitwagon.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox