* [PATCH] IA64: cast has a higher precedence than '?'
@ 2009-02-20 12:05 Roel Kluin
2009-02-20 12:37 ` Ingo Molnar
2009-02-20 12:37 ` Ingo Molnar
0 siblings, 2 replies; 5+ messages in thread
From: Roel Kluin @ 2009-02-20 12:05 UTC (permalink / raw)
To: mingo; +Cc: lkml, Andrew Morton
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 '?'
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/arch/x86/include/asm/syscall.h b/arch/x86/include/asm/syscall.h
index d82f39b..b8a1933 100644
--- a/arch/x86/include/asm/syscall.h
+++ b/arch/x86/include/asm/syscall.h
@@ -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
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] IA64: cast has a higher precedence than '?'
2009-02-20 12:05 [PATCH] IA64: cast has a higher precedence than '?' Roel Kluin
@ 2009-02-20 12:37 ` Ingo Molnar
2009-02-20 12:37 ` Ingo Molnar
1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2009-02-20 12:37 UTC (permalink / raw)
To: Roel Kluin; +Cc: mingo, lkml, Andrew Morton
* Roel Kluin <roel.kluin@gmail.com> wrote:
> 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 '?'
> @@ -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
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] IA64: cast has a higher precedence than '?'
2009-02-20 12:05 [PATCH] IA64: cast has a higher precedence than '?' Roel Kluin
2009-02-20 12:37 ` Ingo Molnar
@ 2009-02-20 12:37 ` Ingo Molnar
1 sibling, 0 replies; 5+ messages in thread
From: Ingo Molnar @ 2009-02-20 12:37 UTC (permalink / raw)
To: Roel Kluin; +Cc: mingo, lkml, Andrew Morton
> --- a/arch/x86/include/asm/syscall.h
> +++ b/arch/x86/include/asm/syscall.h
btw., the subject line is wrong - this is not an ia64 patch but
an x86 patch.
Ingo
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH] IA64: cast has a higher precedence than '?'
@ 2009-02-20 11:52 Roel Kluin
2009-02-20 12:50 ` Andreas Schwab
0 siblings, 1 reply; 5+ messages in thread
From: Roel Kluin @ 2009-02-20 11:52 UTC (permalink / raw)
To: linux-ia64
A cast has a higher precedence than '?'
Signed-off-by: Roel Kluin <roel.kluin@gmail.com>
---
diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h
index 2f758a4..3fc1832 100644
--- a/arch/ia64/include/asm/syscall.h
+++ b/arch/ia64/include/asm/syscall.h
@@ -64,7 +64,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
{
#ifdef CONFIG_IA32_SUPPORT
if (IS_IA32_PROCESS(regs)) {
- regs->r8 = (long) error ? error : val;
+ regs->r8 = (long) (error ? error : val);
return;
}
#endif
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] IA64: cast has a higher precedence than '?'
2009-02-20 11:52 Roel Kluin
@ 2009-02-20 12:50 ` Andreas Schwab
0 siblings, 0 replies; 5+ messages in thread
From: Andreas Schwab @ 2009-02-20 12:50 UTC (permalink / raw)
To: linux-ia64
Roel Kluin <roel.kluin@gmail.com> writes:
> diff --git a/arch/ia64/include/asm/syscall.h b/arch/ia64/include/asm/syscall.h
> index 2f758a4..3fc1832 100644
> --- a/arch/ia64/include/asm/syscall.h
> +++ b/arch/ia64/include/asm/syscall.h
> @@ -64,7 +64,7 @@ static inline void syscall_set_return_value(struct task_struct *task,
> {
> #ifdef CONFIG_IA32_SUPPORT
> if (IS_IA32_PROCESS(regs)) {
> - regs->r8 = (long) error ? error : val;
> + regs->r8 = (long) (error ? error : val);
The cast can be removed, it has no influence whatsoever.
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2009-02-20 12:50 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-02-20 12:05 [PATCH] IA64: cast has a higher precedence than '?' Roel Kluin
2009-02-20 12:37 ` Ingo Molnar
2009-02-20 12:37 ` Ingo Molnar
-- strict thread matches above, loose matches on Subject: below --
2009-02-20 11:52 Roel Kluin
2009-02-20 12:50 ` Andreas Schwab
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.