On 26-Aug-97, Erik Warmelink wrote to Mathieu Bouchard about converting sound
data.
MB>>> i'd rather do: x=(x+128)/256
EW> Thinking about it (I knew I had forgotten something ;-)), it is
EW> also dangerous for signed values. 32767 + 128 == -32641, resulting
EW> in -127, not really close to 127.99609375. OTOH using 32bit
I have no idea why you are adding 128 to x before dividing, but I have some
knowledge of maths and quickly figured out (as you probably did) that it
could be replaced with "x = x / 256 + 128 / 256" avoiding 16-bit integer
overflow.
Javier Kohen [The_Crusher] http://jkohen.base.org
... You Don't Want Money, You Don't Want a Diamond Ring, You Say You Want My
Lovin' More Than Any Other Thing þ Ramones
-!- CrusherTag 0.3.2.
--- Terminate 5.00/Pro
---------------
* Origin: ASS - Anti Stones Squad - ASS Simply Sucks (4:900/748.3)
|