]> git.alsa-project.org Git - alsa-plugins.git/commitdiff
[RFC] Don't use pow() for calculating a power of 2, use shift instead.
authorDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Fri, 21 Nov 2008 01:00:58 +0000 (02:00 +0100)
committerDiego E. 'Flameeyes' Pettenò <flameeyes@gmail.com>
Fri, 21 Nov 2008 12:06:58 +0000 (13:06 +0100)
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>
maemo/Makefile.am
maemo/dsp-protocol.c

index 47b4548bcfbea49e53cfc1c7c03ef2bc2c88c372..268478159e813b93e6992f0fe9f6f14f230194a2 100644 (file)
@@ -8,10 +8,10 @@ AM_CFLAGS = -Wall -O2 @ALSA_CFLAGS@ $(DBUS_CFLAGS)
 AM_LDFLAGS = -module -avoid-version -export-dynamic -no-undefined $(LDFLAGS_NOUNDEFINED)
 
 libasound_module_pcm_alsa_dsp_la_SOURCES = dsp-protocol.c alsa-dsp.c
-libasound_module_pcm_alsa_dsp_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lm -lpthread 
+libasound_module_pcm_alsa_dsp_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lpthread 
 
 libasound_module_ctl_dsp_ctl_la_SOURCES = dsp-protocol.c dsp-ctl.c
-libasound_module_ctl_dsp_ctl_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lm -lpthread 
+libasound_module_ctl_dsp_ctl_la_LIBADD = @ALSA_LIBS@ $(DBUS_LIBS) -lpthread 
 
 noinst_HEADERS = constants.h debug.h dsp-protocol.h list.h reporting.h \
                 types.h
index df155c6478d247cc27fcf00615640a4617c03e23..2fd1128a7990c3600f3bbf664cfdf6e9e40f7e66 100644 (file)
@@ -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)