ALSA: emu10k1: simplify snd_emu10k1_audigy_dsp_convert_32_to_2x16()
authorOswald Buddenhagen <oswald.buddenhagen@gmx.de>
Wed, 10 May 2023 17:39:07 +0000 (19:39 +0200)
committerTakashi Iwai <tiwai@suse.de>
Fri, 12 May 2023 07:17:04 +0000 (09:17 +0200)
commit4c7bfbcf7516b0804ba0204e865f885baca604e4
treeb11f3cac866e1fb6d562d2ce63b56ab9513e3bd4
parent4102ac29759586e86cf129d66fc5ad5406a431a8
ALSA: emu10k1: simplify snd_emu10k1_audigy_dsp_convert_32_to_2x16()

Instead of spending lots of instructions on masking and transplanting
the sign bit, sidestep the issue by replacing the last bit shift with
a wrapping addition to self.

Solution stolen from kX-project, after I pondered other ideas first.

Also, the function really doesn't need to return a constant int value.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Link: https://lore.kernel.org/r/20230510173917.3073107-5-oswald.buddenhagen@gmx.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/emu10k1/emufx.c