[vorbis-dev] longs

Bob Bradley bob at chaoticsoftware.com
Mon Sep 11 14:34:19 PDT 2000



>Please change all longs to int, and never use them in the future :)
>They arent needed as on most platforms they are the same size. (which is 
>the assumption made in the ogg code anyway)
>The reason for this is i will have vorbis support on playstation 2, but 
>long is 64 bits, and they are excruciatingly slow.

Why not typedef something like UInt32/SInt32 so you get exactly what you 
want on any platform? For Playstation 2, you can use typedef int SInt32 
and other platforms with 32-bit longs, it can be typedef long SInt32. The 
same goes for char, short, and long long (SInt8, SInt16, and SInt64 
respectively). An even better solution in some cases is to use 
purposefully named types (e.g. VorbisByteCount) as those types don't 
imply size and can grow as needed.

Personally, I think it's better to never use native C data types directly 
as their size is not constant. The problem you ran into is a good example 
of why typedefs should be used instead.

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