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: David Laight <hidden>
Date: 2012-07-02 12:18:48

 
"David Laight" [off-list ref] writes:
quoted
 
quoted
quoted
Or write it as (!field || !(typeof(field))~field) which more
closely
quoted
quoted
quoted
resembles what the macro name expresses.
Better still, or maybe:

	field == 0 || field == (typeof field)~0
Which doesn't work when sizeof(field) > sizeof(int).
Needs another cast.

	field == 0 || field == (typeof field)~(typeof field)0
You can avoid that by using (typeof field)-1.
Gah, I thought I knew the integral promotion rules!
-1 and ~0 are both 'integer' and get treated the same.

A quick test shows that gcc does sign extend when converting
32bit int to 64bit unsigned long long.
Which probably means that is required by the standard!

	David
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help