[xiph-cvs] cvs commit: ogg/src bitwise.c

Monty xiphmont at xiph.org
Tue Oct 7 19:53:40 PDT 2003



xiphmont    03/10/07 22:53:40

  Modified:    src      bitwise.c
  Log:
  Fix for bug 458

Revision  Changes    Path
1.16      +11 -6     ogg/src/bitwise.c

Index: bitwise.c
===================================================================
RCS file: /usr/local/cvsroot/ogg/src/bitwise.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -r1.15 -r1.16
--- bitwise.c	29 Sep 2003 14:21:24 -0000	1.15
+++ bitwise.c	8 Oct 2003 02:53:40 -0000	1.16
@@ -11,7 +11,7 @@
  ********************************************************************
 
   function: packing variable sized words into an octet stream
-  last mod: $Id: bitwise.c,v 1.15 2003/09/29 14:21:24 giles Exp $
+  last mod: $Id: bitwise.c,v 1.16 2003/10/08 02:53:40 xiphmont Exp $
 
  ********************************************************************/
 
@@ -150,7 +150,8 @@
                                      long bits,
                                      void (*w)(oggpack_buffer *,
                                                unsigned long,
-					       int)){
+					       int),
+				     int msb){
   unsigned char *ptr=(unsigned char *)source;
 
   long bytes=bits/8;
@@ -175,16 +176,20 @@
     *b->ptr=0;
 
   }
-  if(bits)
-    w(b,(unsigned long)(ptr[bytes]),bits);    
+  if(bits){
+    if(msb)
+      w(b,(unsigned long)(ptr[bytes]>>(8-bits)),bits);    
+    else
+      w(b,(unsigned long)(ptr[bytes]),bits);    
+  }
 }
 
 void oggpack_writecopy(oggpack_buffer *b,void *source,long bits){
-  oggpack_writecopy_helper(b,source,bits,oggpack_write);
+  oggpack_writecopy_helper(b,source,bits,oggpack_write,0);
 }
 
 void oggpackB_writecopy(oggpack_buffer *b,void *source,long bits){
-  oggpack_writecopy_helper(b,source,bits,oggpackB_write);
+  oggpack_writecopy_helper(b,source,bits,oggpackB_write,1);
 }
 
 void oggpack_reset(oggpack_buffer *b){

<p><p>--- >8 ----
List archives:  http://www.xiph.org/archives/
Ogg project homepage: http://www.xiph.org/ogg/
To unsubscribe from this list, send a message to 'cvs-request at xiph.org'
containing only the word 'unsubscribe' in the body.  No subject is needed.
Unsubscribe messages sent to the list will be ignored/filtered.



More information about the commits mailing list