[vorbis-dev] optimizing float to int conversions
ogg at illiminable.com
Wed May 5 11:05:17 PDT 2004
----- Original Message -----
From: "dean gaudet" <dean-list-vorbis-dev at arctic.org>
To: <vorbis-dev at xiph.org>
Sent: Thursday, May 06, 2004 1:34 AM
Subject: Re: [vorbis-dev] optimizing float to int conversions
<p>> 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
> > or more bits in either direction you get zero anyway (is there some case
> > not thinking of that this is not true ?)... so you can remove a a
> > 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
Hmmm.. fair enoughi can't find anything specific on C++ but my compiler
certainly doesn't just shift using the low 5-bits... I'll take your word for
it in C... i'd be interested to find out if it is undefined in C++ too.
I did find this though... (C++ draft Standard 1996)
3 The value of E1 >> E2 is E1 right-shifted E2 bit positions. If E1 has
an unsigned type or if E1 has a signed type and a nonnegative value,
the value of the result is the integral part of the quotient of E1
divided by the quantity 2 raised to the power E2. If E1 has a signed
type and a negative value, the resulting value is implementation-
So if the number being shifted is signed and engative, this is
imlpementation dependant too :| Interesting !
> --- >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.
<p>--- >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