[vorbis-dev] fast math optimization patch

Michael Smith msmith at labyrinth.net.au
Sat Feb 10 20:21:30 PST 2001



At 06:06 PM 2/10/01 -0800, you wrote:
>
>
>   Good points.  Would we rather get an compile time error when there is 
>a possible optimization that you're missing out on (forcing a developer 
>on the platform in question to make this decision as part of their 
>porting process), or would we rather just punt and run slower?

The latter. Absolutely. Of course, it'd be good to make it very clear that
you SHOULD define the relevent things for each platform when porting, but
not doing so shouldn't make it not compile.

>   Could you describe what sort of bitfield portability problems you know 
>about?  I haven't seen any real problems with bitfields (although I 
>certainly don't use every compiler in the world or read ANSI C standards 
>for fun :)

Depends on your compiler. Basically, the compiler is free to do whatever
the hell it wants to with bitfields. It's not much harder to write code to
do this without using bitfields - basically you have to do the masks/shifts
yourself, instead of hoping the compiler will do so sensibly. 

>
>   If people do run into bitfield portability problems, we could take a 
>couple of approaches:
>
>- Only turn on the optimizations on specific platforms (gcc/ppc, 
>gcc/x86, msvc++/x86, for example) and disable them otherwise
>- Write some autoconf tests to see what the current compiler/cpu does 
>and automatically turn stuff on/off.
>- ... something else?

Yes. Only makes sense to turn them on on platforms where they're known to
work. Minimising use of autoconf for this sort of thing is good, since
libvorbis is useful (and is used) on many more platforms than autoconf
exists on. Using it is ok, but don't make it too hard to do the same
WITHOUT autoconf.

In fact, it's probably best to use autoconf to define your endianness on
unix. win32 and macos can be defined based on OS, since they aren't
cross-platform. That handles 99% of the cases of interest, and as long as
it safely falls back on unoptimised code for the other 1%, things should be
ok.

Michael

--- >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