Update of /cvsroot/blob/blob/src/lib
In directory usw-pr-cvs1:/tmp/cvs-serv23468
Modified Files:
mini_inflate.c
Log Message:
its not *exactly* memset (quite different actually)
Index: mini_inflate.c
===================================================================
RCS file: /cvsroot/blob/blob/src/lib/mini_inflate.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- mini_inflate.c 17 Feb 2002 15:41:54 -0000 1.1
+++ mini_inflate.c 26 Apr 2002 07:01:05 -0000 1.2
@@ -93,6 +93,14 @@
11, 4, 12, 3, 13, 2, 14, 1, 15};
+static void int_memset(int *s, const int c, long n)
+{
+ n--;
+ for (;n > 0; n--) s[n] = c;
+ s[0] = c;
+}
+
+
/* associate a stream with a block of data and reset the stream */
static void init_stream(struct bitstream *stream, unsigned char *data)
{
@@ -270,9 +278,9 @@
static void init_code_tables(struct huffman_set *set)
{
- memset(set->lengths, 0, set->num_symbols);
- memset(set->count, 0, set->bits);
- memset(set->first, 0, set->bits);
+ int_memset(set->lengths, 0, set->num_symbols);
+ int_memset(set->count, 0, set->bits);
+ int_memset(set->first, 0, set->bits);
}
/* read in the huffman codes for dynamic decoding (section 3.2.7) */
@@ -388,19 +396,19 @@
struct huffman_set *lengths = &(stream->lengths);
struct huffman_set *distance = &(stream->distance);
- memset(lengths->count, 0, 16);
- memset(lengths->first, 0, 16);
- memset(lengths->lengths, 8, 144);
- memset(lengths->lengths + 144, 9, 112);
- memset(lengths->lengths + 256, 7, 24);
- memset(lengths->lengths + 280, 8, 8);
+ int_memset(lengths->count, 0, 16);
+ int_memset(lengths->first, 0, 16);
+ int_memset(lengths->lengths, 8, 144);
+ int_memset(lengths->lengths + 144, 9, 112);
+ int_memset(lengths->lengths + 256, 7, 24);
+ int_memset(lengths->lengths + 280, 8, 8);
lengths->count[7] = 24;
lengths->count[8] = 152;
lengths->count[9] = 112;
- memset(distance->count, 0, 16);
- memset(distance->first, 0, 16);
- memset(distance->lengths, 5, 32);
+ int_memset(distance->count, 0, 16);
+ int_memset(distance->first, 0, 16);
+ int_memset(distance->lengths, 5, 32);
distance->count[5] = 32;
|