lkml.org 
[lkml]   [2002]   [Aug]   [27]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: atomic64_t proposal
From
Date
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.

|> #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.

Andreas.

--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Deutschherrnstr. 15-19, D-90429 Nürnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:28    [W:0.075 / U:0.028 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site