[vorbis-dev] libvorbis on Classic MacOS

Timothy Wayper timmy at wunderbear.com
Thu Feb 6 17:41:21 PST 2003

>>>> The problem is that our classic MacOS build is currently under 
>>>> MPW/MrC. I can compile libogg/libvorbis fine (requires enabling the 
>>>> intrinsic alloca support), but there seems to be a problem with the 
>>>> code produced.
> OK. I know exactly what the problem is now, and it's pretty weird. 
> pow() returns completely bogus results when called from res0_look(). 
> For example, pow(8.0, 2.0) returns 64.0 from anywhere else (including 
> before or after in _vds_shared_init()), but from anywhere in 
> res0_look() it appears to return 7.10152e-295. Everything else looks 
> perfect. Sigh. This looks like a weird-arse compiler problem...

After much struggle, the problem turned out to be really simple. Forget 
my accusation of pow(), that turned out to be a debugging problem, but 
that problem gave me a clue as to the real error:

rint() is provided by the standard classic MacOS mathlib, but the 
prototype is in fp.h, not math.h! (Remember, rint() is non-standard). 
Because of this, the code was assuming rint returned an int, and ended 
up using a garbage value.

I thought I had fixed this, but it turned out I'd only fixed it for 
vorbisfile (which I'd built separately). A quick change to os.h was all 
that was required. The thing this re-enforces for me is always to turn 
on "require function prototypes", even on classic-C code like 
libvorbis. Oh well, live and learn :-)

Anyway, if anyone else ever needs to build under MPW/MrC, I now have 
makefiles and diffs...

Tim Wayper

--- >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 'vorbis-dev-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 Vorbis-dev mailing list