[op25-dev] Re: patches

ikj1234i@yahoo.com [op25-dev] op25-dev at yahoogroups.com
Sun Nov 9 19:15:19 UTC 2014


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!

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/op25-dev/attachments/20141109/6becc94e/attachment.html>

More information about the op25-dev mailing list