public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] sparc,sparc64: replace parentheses in pmul()
@ 2009-11-05 16:40 Roel Kluin
  2009-11-08  8:28 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: Roel Kluin @ 2009-11-05 16:40 UTC (permalink / raw)
  To: David S. Miller, sparclinux, Andrew Morton, LKML

`>>' has a higher precedence than `?' so src2 evaluated to
either 16 or 0 dependent on the bits set in rs2.

Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
 arch/sparc/kernel/visemul.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

I am not 100% sure that the code was incorrect, however, if it
was intended I think it is a very strange way to write it.

Roel

diff --git a/arch/sparc/kernel/visemul.c b/arch/sparc/kernel/visemul.c
index b956fd7..d231cbd 100644
--- a/arch/sparc/kernel/visemul.c
+++ b/arch/sparc/kernel/visemul.c
@@ -617,7 +617,7 @@ static void pmul(struct pt_regs *regs, unsigned int insn, unsigned int opf)
 		rs2 = fps_regval(f, RS2(insn));
 
 		rd_val = 0;
-		src2 = (rs2 >> (opf == FMUL8x16AU_OPF) ? 16 : 0);
+		src2 = rs2 >> (opf == FMUL8x16AU_OPF ? 16 : 0);
 		for (byte = 0; byte < 4; byte++) {
 			u16 src1 = (rs1 >> (byte * 8)) & 0x00ff;
 			u32 prod = src1 * src2;

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] sparc,sparc64: replace parentheses in pmul()
  2009-11-05 16:40 [PATCH] sparc,sparc64: replace parentheses in pmul() Roel Kluin
@ 2009-11-08  8:28 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2009-11-08  8:28 UTC (permalink / raw)
  To: roel.kluin; +Cc: sparclinux, akpm, linux-kernel

From: Roel Kluin <roel.kluin@gmail.com>
Date: Thu, 05 Nov 2009 17:40:44 +0100

> `>>' has a higher precedence than `?' so src2 evaluated to
> either 16 or 0 dependent on the bits set in rs2.
> 
> Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
> ---
>  arch/sparc/kernel/visemul.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> I am not 100% sure that the code was incorrect, however, if it
> was intended I think it is a very strange way to write it.

Your fix is correct, thanks Roel!

I really need to write a testsuite for this VIS emulation code.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-11-08  8:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-11-05 16:40 [PATCH] sparc,sparc64: replace parentheses in pmul() Roel Kluin
2009-11-08  8:28 ` David Miller

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox