diff mbox series

[v2,4/4] ALSA: emu10k1: optimize mask calculation in snd_emu10k1_ptr_read()

Message ID 20230514170323.3408798-4-oswald.buddenhagen@gmx.de
State Accepted
Commit 2e9bd50f117ea3f638802627a196949f7eefcf02
Headers show
Series [v2,1/4] ALSA: emu10k1: automate encoding of sub-register definitions | expand

Commit Message

Oswald Buddenhagen May 14, 2023, 5:03 p.m. UTC
Unlike in snd_emu10k1_ptr_write(), we don't need to keep the value's
bits in place, so we can save one shift.

Signed-off-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
---
 sound/pci/emu10k1/io.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/sound/pci/emu10k1/io.c b/sound/pci/emu10k1/io.c
index 2d6bbb77c961..59b0f4d08c6b 100644
--- a/sound/pci/emu10k1/io.c
+++ b/sound/pci/emu10k1/io.c
@@ -50,9 +50,9 @@  unsigned int snd_emu10k1_ptr_read(struct snd_emu10k1 * emu, unsigned int reg, un
 		
 		size = (reg >> 24) & 0x3f;
 		offset = (reg >> 16) & 0x1f;
-		mask = ((1 << size) - 1) << offset;
+		mask = (1 << size) - 1;
 		
-		return (val & mask) >> offset;
+		return (val >> offset) & mask;
 	} else {
 		return val;
 	}