Thread (45 messages) flat view 45 messages, 7 authors, 2012-07-03

Re: [PATCH net-next 09/10] net/mlx4_en: Manage flow steering rules with ethtool

From: Andreas Schwab <hidden>
Date: 2012-07-01 18:49:05

Joe Perches [off-list ref] writes:
On Sun, 2012-07-01 at 09:38 -0700, Joe Perches wrote:
quoted
I think this macro is suboptimal because
negated names are easy to misuse.

I think type is also unnecessary and too
easy to mismatch or keep up to date with
field type changes.

Perhaps it's better as:

#define all_zeros_or_all_ones(field)		\
({						\
	field && (typeof(field))~field;		\
})
Umm, or not.

It helps when I actually test the code not just type
it into an email client.

	!(field && (typeof(field))~field)
Or write it as (!field || !(typeof(field))~field) which more closely
resembles what the macro name expresses.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help