Skip to contentSkip to conversation

IA64: cast has a higher precedence than '?'

PATCH In review Roel Kluin 2 participants 3 messages Feb 20, 2009 x86

lore
Share & tools
lore

Roel Kluin

author
#0 lore raw

PATCH 1/1 IA64: cast has a higher precedence than '?'

because of the ?: this is not strictly necessary, but I think the added parentheses are nice here.

--------------------------->8-------------8<------------------------------ A cast has a higher precedence than '?'

---

arch/x86/include/asm/syscall.h +1 -1
index d82f39b..b8a1933 100644
@@ -61,7 +61,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
 					    struct pt_regs *regs,
 					    int error, long val)
 {
-	regs->ax = (long) error ?: val;
+	regs->ax = (long) (error ?: val);
 }
 
 #ifdef CONFIG_X86_32
#1 lore raw

arch/x86/include/asm/syscall.h static inline void syscall_set_return_value(struct task_struct *task, · line 64

Quoted 12 lines · Roel Kluin

because of the ?: this is not strictly necessary, but I think the added parentheses are nice here.

--------------------------->8-------------8<------------------------------ A cast has a higher precedence than '?'

arch/x86/include/asm/syscall.h +1 -1
@@ -61,7 +61,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
 					    struct pt_regs *regs,
 					    int error, long val)
 {
-	regs->ax = (long) error ?: val;
+	regs->ax = (long) (error ?: val);

it doesnt matter, does it? the 32-bit entity here is 'error', so casting it to 64-bit long is just as fine as casting the end result to long. In fact this should be the best:

	regs->ax = error ?: val;

as the 32-bit 'error' will be extended to 64 bits anyway.

Ingo

#2 lore raw
In reply to Roel Kluin

arch/x86/include/asm/syscall.h

Quoted 3 lines
arch/x86/include/asm/syscall.h +0 -0

btw., the subject line is wrong - this is not an ia64 patch but
an x86 patch.

Ingo