[xiph-cvs] cvs commit: vorbis/lib vorbisfile.c

Michael Smith msmith at xiph.org
Sat Oct 26 06:37:04 PDT 2002



msmith      02/10/26 09:37:04

  Modified:    lib      vorbisfile.c
  Log:
  gcc 3.x was miscompiling this function at -O2 and above. Rearrange things
  to make it get it right.

Revision  Changes    Path
1.64      +8 -2      vorbis/lib/vorbisfile.c

Index: vorbisfile.c
===================================================================
RCS file: /usr/local/cvsroot/vorbis/lib/vorbisfile.c,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -r1.63 -r1.64
--- vorbisfile.c	11 Oct 2002 08:22:18 -0000	1.63
+++ vorbisfile.c	26 Oct 2002 13:37:03 -0000	1.64
@@ -11,7 +11,7 @@
  ********************************************************************
 
  function: stdio-based convenience library for opening/seeking/decoding
- last mod: $Id: vorbisfile.c,v 1.63 2002/10/11 08:22:18 xiphmont Exp $
+ last mod: $Id: vorbisfile.c,v 1.64 2002/10/26 13:37:03 msmith Exp $
 
  ********************************************************************/
 
@@ -782,9 +782,15 @@
   if(i<0){
     ogg_int64_t bits=0;
     int i;
+    float br;
     for(i=0;i<vf->links;i++)
       bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8;
-    return(rint(bits/ov_time_total(vf,-1)));
+    /* This once read: return(rint(bits/ov_time_total(vf,-1)));
+     * gcc 3.x on x86 miscompiled this at optimisation level 2 and above,
+     * so this is slightly transformed to make it work.
+     */
+    br = bits/ov_time_total(vf,-1);
+    return(rint(br));
   }else{
     if(vf->seekable){
       /* return the actual bitrate */

<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