[xiph-commits] r8838 - trunk/speex/libspeex

jm at motherfish-iii.xiph.org jm at motherfish-iii.xiph.org
Sat Feb 5 00:16:50 PST 2005


Author: jm
Date: 2005-02-05 00:16:49 -0800 (Sat, 05 Feb 2005)
New Revision: 8838

Modified:
   trunk/speex/libspeex/bits.c
Log:
removed unnecessary (re)initialization of the bit packer bytes


Modified: trunk/speex/libspeex/bits.c
===================================================================
--- trunk/speex/libspeex/bits.c	2005-02-05 07:43:06 UTC (rev 8837)
+++ trunk/speex/libspeex/bits.c	2005-02-05 08:16:49 UTC (rev 8838)
@@ -44,12 +44,10 @@
 
 void speex_bits_init(SpeexBits *bits)
 {
-   int i;
    bits->bytes = (char*)speex_alloc(MAX_BYTES_PER_FRAME);
    bits->buf_size = MAX_BYTES_PER_FRAME;
 
-   for (i=0;i<bits->buf_size;i++)
-      bits->bytes[i]=0;
+   bits->bytes[0]=0;
    bits->nbBits=0;
    bits->bytePtr=0;
    bits->bitPtr=0;
@@ -59,12 +57,10 @@
 
 void speex_bits_init_buffer(SpeexBits *bits, void *buff, int buf_size)
 {
-   int i;
    bits->bytes = (char*)buff;
    bits->buf_size = buf_size;
 
-   for (i=0;i<buf_size;i++)
-      bits->bytes[i]=0;
+   bits->bytes[0]=0;
    bits->nbBits=0;
    bits->bytePtr=0;
    bits->bitPtr=0;
@@ -81,9 +77,7 @@
 
 void speex_bits_reset(SpeexBits *bits)
 {
-   int i;
-   for (i=0;i<bits->buf_size;i++)
-      bits->bytes[i]=0;
+   bits->bytes[0]=0;
    bits->nbBits=0;
    bits->bytePtr=0;
    bits->bitPtr=0;
@@ -249,6 +243,7 @@
       {
          bits->bitPtr=0;
          bits->bytePtr++;
+         bits->bytes[bits->bytePtr] = 0;
       }
       bits->nbBits++;
       nbBits--;



More information about the commits mailing list