Commit 25348260 authored by Michael Smith's avatar Michael Smith
Browse files

gcc 3.x was miscompiling this function at -O2 and above. Rearrange things

to make it get it right.

svn path=/trunk/vorbis/; revision=4054
parent ed69b103
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
******************************************************************** ********************************************************************
function: stdio-based convenience library for opening/seeking/decoding 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 @@ long ov_bitrate(OggVorbis_File *vf,int i){ ...@@ -782,9 +782,15 @@ long ov_bitrate(OggVorbis_File *vf,int i){
if(i<0){ if(i<0){
ogg_int64_t bits=0; ogg_int64_t bits=0;
int i; int i;
float br;
for(i=0;i<vf->links;i++) for(i=0;i<vf->links;i++)
bits+=(vf->offsets[i+1]-vf->dataoffsets[i])*8; 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{ }else{
if(vf->seekable){ if(vf->seekable){
/* return the actual bitrate */ /* return the actual bitrate */
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment