[vorbis-dev] Modification requests / question

Cherniavsky Beni cben at crosswinds.net
Tue Dec 26 02:56:50 PST 2000

Michael Smith wrote:
> >> #define vorbis_ftoi(f) ((int)(f+.5f))
> >>
> >Is f always >= 0 ?
> >
> >If no, the function is works wrong.
> >If yes, the name of the function is dangerous.
> >
> >May be someone can call it with vorbis_ftoi(-2.1) and gets a -1.
> No, it's not always called with f >= 0. However, it's used only in two
> places - in one, it compensates for this problem appropriately, so it's not
> a problem.
> In the other, it isn't sensitive to slightly-off results (and errors here
> can't propogate any further) - the speed difference seems worthwhile in
> practice.
It seems to me that if it's used only in two places, with some wrapping
in one of them and specific acceptance for wrong results in the other,
has a confusing name and is trivially simple, there are enough reasons
to dispense of it altogether and hand-inline it in the two places.

Beni Cherniavsky <cben at crosswinds.net>
                 (also scben at t2,cben at tx in Technion)

  No, No! You're not thinking; you're just being logical.
                                             - Niels Bohr

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