[vorbis-dev] optimizing float to int conversions

dean gaudet dean-list-vorbis-dev at arctic.org
Wed May 5 10:34:12 PDT 2004



On Thu, 6 May 2004, illiminable wrote:

> Assuming your ints are of size 32 bits (I'm pretty sure this is a safe
> assumption in ogg), this is not necessary if you shift any 32 bit int by 32
> or more bits in either direction you get zero anyway (is there some case i'm
> not thinking of that this is not true ?)... so you can remove a a comparison
> and jump there. All bits left of the 24th bit would be zero anyway.

C doesn't specify what happens when you shift more than the data size...
and on x86 the low 5-bits of variable shift amounts are used regardless of
what is in the upper bits.  it doesn't truncate to 0 like you're
expecting.

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