Russell

These patches look really great and I think we should merge them into OP25.  The bch check does look like it is redundant but it isn't 100% clear what the "perfect" solution would be anyway.

As far as this one:
> sample = 32767 * (sample < 0) ? -1 : 1; // * sgn(sample)
>
> Multiplication has higher precedence than the ternary conditional, so

the intent of this code is to ensure that 'sample' is confined to the range [-32K, +32K].  The above line of code would only be executed if there's an overflow (which should not occur, in theory).  So if it's greater than 32,767 we want to set it to 32,767 (and similarly for the - case, if it's less than -32K we limit it to -32K).  So it does look like it needs a set of ( ) added around everything after the * .  For that matter, not sure why it couldn't just be
   sample = 32767 * sgn(sample);
as suggested in the code...

Thx Russ!

Max

__._,_.___

Posted by: ikj1234i@yahoo.com
Reply via web post Reply to sender Reply to group Start a New Topic Messages in this topic (3)

.

__,_._,___