[ovs-dev] [PATCH 1/2] util: Make ctz() handle 64-bit integers instead of a separate ctz64().
Ben Pfaff
blp at nicira.com
Mon Nov 18 22:40:38 UTC 2013
On Mon, Nov 18, 2013 at 02:38:50PM -0800, Jarno Rajahalme wrote:
> One question still:
>
> On Nov 18, 2013, at 1:19 PM, Ben Pfaff <blp at nicira.com> wrote:
> > return popcount(n) + popcount(n >> 32);
> > @@ -341,7 +332,7 @@ ctz(uint32_t n)
> > static inline int
> > ctz64(uint64_t n)
> > {
> > - return n ? raw_ctz64(n) : 64;
> > + return n ? raw_ctz(n) : 64;
> > }
> >
>
> Did you intend to define ctz(uint64_t) and not define ctz64() at all?
I got the commit message wrong, sorry. This commit is intended to be
entirely about raw_ctz() and raw_ctz64(), specifically getting rid of
the latter. It looks like I got the code right but the commit message
totally wrong. Here's what I've now edited the commit message to:
util: Make raw_ctz() accept 64-bit integers.
Having a single function that can do raw_ctz() on any integer type is
easier for callers to get right, and there is no real downside in the
implementation.
Signed-off-by: Ben Pfaff <blp at nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme at nicira.com>
I think I got confused because originally I did want to get rid of
ctz64(). However that's not possible with the current definition of
ctz() and ctz64(), since the return value for n==0 differs in each
case.
Does the commit make sense with the correct log message?
Thanks,
Ben.
More information about the dev
mailing list