All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: david.stevens@oracle.com
Cc: netdev@vger.kernel.org
Subject: Re: [PATCHv3 net-next 1/3] sunvnet: upgrade to VIO protocol version 1.6
Date: Sat, 13 Sep 2014 23:01:20 -0400 (EDT)	[thread overview]
Message-ID: <20140913.230120.511140402106277600.davem@davemloft.net> (raw)
In-Reply-To: <5414FFDD.9050509@oracle.com>

From: David L Stevens <david.stevens@oracle.com>
Date: Sat, 13 Sep 2014 22:39:25 -0400

> 
> 
> On 09/13/2014 04:18 PM, David Miller wrote:
>> From: David L Stevens <david.stevens@oracle.com>
> 
>> static inline bool vio_version_before(struct vio_driver_state *vio,
>> 				      u16 major, u16 minor)
>> {
>> 	u32 have = (u32)vio->major << 16 | vio->minor;
>> 	u32 want = (u32)major << 16 | minor;
>> 
>> 	return have < want;
>> }
>> static inline bool vio_version_after_eq(struct vio_driver_state *vio,
>> 					u16 major, u16 minor)
>> {
>> 	u32 have = (u32)vio->major << 16 | vio->minor;
>> 	u32 want = (u32)major << 16 | minor;
>> 
>> 	return have >= want;
>> }
>> 
>> Something like that.
> 
> Sure. I was thinking about something like:
> 
> #define VIO_VER(major, minor)	(((major)<<16)|(minor))
> 
> change the version struct to a 32-bit int, and do things like:
> 
> 	if (vio->ver > VIO_VER(1,6)) {
> 
> unless you have a preference. (?)

I hate wasting space in a structure just to avoid some harmless
casting in a helper function that is simply trying to optimize
a comparison.

That's why I suggested the inline helpers above, which arguments
are strongly typed.

  reply	other threads:[~2014-09-14  3:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-13 16:01 [PATCHv3 net-next 1/3] sunvnet: upgrade to VIO protocol version 1.6 David L Stevens
2014-09-13 20:18 ` David Miller
2014-09-14  2:39   ` David L Stevens
2014-09-14  3:01     ` David Miller [this message]
2014-09-14  3:43       ` Raghuram Kothakota
2014-09-14  3:30 ` Raghuram Kothakota
2014-09-14 12:02   ` David L Stevens
2014-09-14 17:21     ` Raghuram Kothakota

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=20140913.230120.511140402106277600.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=david.stevens@oracle.com \
    --cc=netdev@vger.kernel.org \
    /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 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.