Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
- Subject: Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- From: Ingo Molnar <mingo@xxxxxxx>
- Date: Fri, 29 Jan 2010 11:04:31 +0100
- Cc: mingo@xxxxxxxxxx, hpa@xxxxxxxxx, eranian@xxxxxxxxxx, linux-kernel@xxxxxxxxxxxxxxx, a.p.zijlstra@xxxxxxxxx, torvalds@xxxxxxxxxxxxxxxxxxxx, tglx@xxxxxxxxxxxxx, linux-tip-commits@xxxxxxxxxxxxxxx
- In-reply-to: <20100129020128.716af8fb.akpm@xxxxxxxxxxxxxxxxxxxx>
- References: <20100122155535.797688466@xxxxxxxxx> <tip-9f41699ed067fa695faff8e2e9981b2550abec62@xxxxxxxxxxxxxx> <20100129020128.716af8fb.akpm@xxxxxxxxxxxxxxxxxxxx>
- User-agent: Mutt/1.5.20 (2009-08-17)
* Andrew Morton <akpm@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Fri, 29 Jan 2010 09:28:04 GMT tip-bot for Peter Zijlstra <a.p.zijlstra@xxxxxxxxx> wrote:
>
> > +#define HWEIGHT8(w) \
> > + ( (!!((w) & (1ULL << 0))) + \
> > + (!!((w) & (1ULL << 1))) + \
> > + (!!((w) & (1ULL << 2))) + \
> > + (!!((w) & (1ULL << 3))) + \
> > + (!!((w) & (1ULL << 4))) + \
> > + (!!((w) & (1ULL << 5))) + \
> > + (!!((w) & (1ULL << 6))) + \
> > + (!!((w) & (1ULL << 7))) )
> > +
> > +#define HWEIGHT16(w) (HWEIGHT8(w) + HWEIGHT8(w >> 8))
> > +#define HWEIGHT32(w) (HWEIGHT16(w) + HWEIGHT16(w >> 16))
> > +#define HWEIGHT64(w) (HWEIGHT32(w) + HWEIGHT32(w >> 32))
>
> Would be nice if it had a comment explaining why it exists. If people
> accidentally use this with non-constant arguments, the generated code
> will be pretty ghastly.
>
> Or add some barf-if-not-__constant_p() thing, perhaps.
Yeah, agreed.
Ingo
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
- Prev by Date:
Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- Next by Date:
Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- Previous by thread:
Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- Next by thread:
Re: [tip:perf/core] bitops: Provide compile time HWEIGHT{8,16,32,64}
- Index(es):
[Index of Archives]
[Linux Stable Commits]
[Linux Stable Kernel]
[Linux Kernel]
[Linux USB Devel]
[Linux Video &Media]
[Linux Audio Users]
[Yosemite News]
[Linux SCSI]