From: Richard Cochran <richardcochran@gmail.com>
To: David Laight <David.Laight@ACULAB.COM>
Cc: "netdev@vger.kernel.org" <netdev@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
David Miller <davem@davemloft.net>,
Jeff Kirsher <jeffrey.t.kirsher@intel.com>,
John Stultz <john.stultz@linaro.org>,
Thomas Gleixner <tglx@linutronix.de>
Subject: Re: [PATCH net-next 1/7] timecounter: provide a macro to initialize the cyclecounter mask field.
Date: Mon, 5 Jan 2015 14:43:27 +0100 [thread overview]
Message-ID: <20150105134327.GA8156@localhost.localdomain> (raw)
In-Reply-To: <063D6719AE5E284EB5DD2968C1650D6D1CAC09D7@AcuExch.aculab.com>
On Mon, Jan 05, 2015 at 01:20:57PM +0000, David Laight wrote:
> > +/* simplify initialization of mask field */
> > +#define CYCLECOUNTER_MASK(bits) (cycle_t)((bits) < 64 ? ((1ULL<<(bits))-1) : -1)
>
> That has me chasing through the C integer promotion rules.
> Better might be:
> ((bits) < 64 ? (1ULL << (bits)) - 1 : (((1ULL << 63) - 1) << 1) + 1)
> I actually suspect there is a standard definition somewhere?
This is an exact copy of CLOCKSOURCE_MASK, and if wrong, then both are
wrong. In any case, I can't see any issue here. Is not
(some_int_type) -1
always equal to
0xf...(width of type)
for all integer types, when using 2s compliment?
Thanks
Richard
next prev parent reply other threads:[~2015-01-05 13:43 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-31 23:33 [PATCH 1/2] e1000e: Include clocksource.h to get CLOCKSOURCE_MASK David Miller
2014-12-31 23:42 ` Jeff Kirsher
2015-01-01 10:39 ` [PATCH net-next 0/7] Fixing the "Time Counter fixes and improvements" Richard Cochran
2015-01-01 10:39 ` [PATCH net-next 1/7] timecounter: provide a macro to initialize the cyclecounter mask field Richard Cochran
2015-01-05 13:20 ` David Laight
2015-01-05 13:43 ` Richard Cochran [this message]
2015-01-05 13:53 ` David Laight
2015-01-01 10:39 ` [PATCH net-next 2/7] bnx2x: convert to CYCLECOUNTER_MASK macro Richard Cochran
2015-01-01 10:39 ` [PATCH net-next 3/7] e1000e: " Richard Cochran
2015-01-01 10:39 ` [PATCH net-next 4/7] igb: " Richard Cochran
2015-01-01 10:39 ` [PATCH net-next 5/7] ixgbe: " Richard Cochran
2015-01-01 10:40 ` [PATCH net-next 6/7] mlx4: include clocksource.h again Richard Cochran
2015-01-01 10:40 ` [PATCH net-next 7/7] microblaze: include the new timecounter header Richard Cochran
2015-01-02 19:22 ` [PATCH net-next V2 0/7] Fixing the "Time Counter fixes and improvements" Richard Cochran
2015-01-02 19:22 ` [PATCH net-next V2 1/7] timecounter: provide a macro to initialize the cyclecounter mask field Richard Cochran
2015-01-02 19:22 ` [PATCH net-next V2 2/7] bnx2x: convert to CYCLECOUNTER_MASK macro Richard Cochran
2015-01-02 19:22 ` [PATCH net-next V2 3/7] e1000e: " Richard Cochran
2015-01-02 19:22 ` [PATCH net-next V2 4/7] igb: " Richard Cochran
2015-01-02 19:22 ` [PATCH net-next V2 5/7] ixgbe: " Richard Cochran
2015-01-02 19:22 ` [PATCH net-next V2 6/7] mlx4: include clocksource.h again Richard Cochran
2015-01-02 19:22 ` [PATCH net-next V2 7/7] microblaze: include the new timecounter header Richard Cochran
2015-01-02 21:48 ` [PATCH net-next V2 0/7] Fixing the "Time Counter fixes and improvements" David Miller
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=20150105134327.GA8156@localhost.localdomain \
--to=richardcochran@gmail.com \
--cc=David.Laight@ACULAB.COM \
--cc=davem@davemloft.net \
--cc=jeffrey.t.kirsher@intel.com \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=tglx@linutronix.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;
as well as URLs for NNTP newsgroup(s).