diff options
author | Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-11-21 02:00:58 +0100 |
---|---|---|
committer | Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com> | 2008-11-21 13:06:58 +0100 |
commit | e4ce5402202d983a84d01555445eeb23e5a9268f (patch) | |
tree | 60bf00769c4f8d0e669cf8fef218e9e663e5ea18 /maemo/dsp-protocol.c | |
parent | 0a957ec80e3184cd4cf76a0ec4e070e59d027f8c (diff) |
[RFC] Don't use pow() for calculating a power of 2, use shift instead.
This assumes that the power2 argument is in the 0-32 range, so this
need to be carefully checked.
Signed-off-by: Diego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Diffstat (limited to 'maemo/dsp-protocol.c')
-rw-r--r-- | maemo/dsp-protocol.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/maemo/dsp-protocol.c b/maemo/dsp-protocol.c index df155c6..2fd1128 100644 --- a/maemo/dsp-protocol.c +++ b/maemo/dsp-protocol.c @@ -1083,7 +1083,7 @@ static void dsp_protocol_linear2Q15(const unsigned short int input, static void dsp_protocol_Q152linear(const unsigned short int scale, const unsigned short int power2, unsigned short int *output) { - float result = scale * 1.0 / 0x8000 * pow(2.0, 1.0 * power2) * 100.0; + float result = scale * 1.0 / 0x8000 * (1 << power2) * 100.0; DENTER(); *output = (short int)(result); if ((result - *output) > 0.5) |