mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Dean Nelson <dcn@sgi.com>
To: schwab@suse.de (Andreas Schwab)
Cc: linux-kernel@vger.kernel.org
Subject: Re: atomic64_t proposal
Date: Wed, 28 Aug 2002 09:59:54 -0500 (CDT)	[thread overview]
Message-ID: <200208281459.JAA83371@cyan.americas.sgi.com> (raw)
In-Reply-To: <je1y8kgjda.fsf@sykes.suse.de> from "Andreas Schwab" at Aug 27, 2002 10:02:57 PM

Andreas Schwab writes:
> 
> Dean Nelson <dcn@sgi.com> writes:
> 
> |> +#define ia64_atomic_add(i,v)						\
> |> +({									\
> |> +	__typeof__((v)->counter) _old, _new;				\
> |> +	CMPXCHG_BUGCHECK_DECL						\
> |> +									\
> |> +	do {								\
> |> +		CMPXCHG_BUGCHECK(v);					\
> |> +		_old = atomic_read(v);					\
> |> +		_new = _old + (i);					\
> |> +	} while (ia64_cmpxchg("acq", (v), _old, _new, sizeof(*(v))) != _old); \
> |> +	(__typeof__((v)->counter)) _new;	/* return new value */	\
> 
> What's the purpose of the cast here? The type of _new is already the
> right one.

You're right, the cast is meaningless and should be removed. It's an artifact
of a macro that had several iterations of development.

> |>  #define atomic_add_return(i,v)						\
> |>  	((__builtin_constant_p(i) &&					\
> |>  	  (   (i ==  1) || (i ==  4) || (i ==  8) || (i ==  16)		\
> |>  	   || (i == -1) || (i == -4) || (i == -8) || (i == -16)))	\
> |>  	 ? ia64_fetch_and_add(i, &(v)->counter)				\
> |> -	 : ia64_atomic_add(i, v))
> |> +	 : ia64_atomic_add((i), (v)))
> 
> The extra parens are useless.

Yep, they're useless. I had introduced them merely to be consistent with
how the other macros in asm-ia64/atomic.h were done (macros that I didn't
modify). But the parentheses can be removed.

Thanks for the corrections.
Dean


  reply	other threads:[~2002-08-28 14:55 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-08-27 19:37 Dean Nelson
2002-08-27 20:02 ` Andreas Schwab
2002-08-28 14:59   ` Dean Nelson [this message]
     [not found] <200208271937.OAA78345@cyan.americas.sgi.com.suse.lists.linux.kernel>
2002-08-27 19:58 ` Andi Kleen
2002-08-27 20:29   ` David S. Miller
2002-08-27 20:54   ` Benjamin LaHaise
2002-08-29 17:15   ` Dean Nelson
2002-08-28 15:45 Robin Holt
2002-08-28 21:39 ` H. Peter Anvin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200208281459.JAA83371@cyan.americas.sgi.com \
    --to=dcn@sgi.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=schwab@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®