Page MenuHomeFreeBSD

sys/bitcount.h: add __const_bitcount<n>
AcceptedPublic

Authored by bz on Thu, Dec 18, 10:51 PM.
Tags
None
Referenced Files
F140043717: D54301.diff
Fri, Dec 19, 11:15 AM
F140030893: D54301.id.diff
Fri, Dec 19, 7:17 AM
F140028795: D54301.id168375.diff
Fri, Dec 19, 6:32 AM
F140026715: D54301.diff
Fri, Dec 19, 5:48 AM
F140009845: D54301.id168375.diff
Thu, Dec 18, 11:51 PM
Subscribers

Details

Reviewers
dumbbell
obiwac
imp
brooks
emaste
Group Reviewers
linuxkpi
Summary

Add a version of const_bitcount<n> which can be used to get the
numbers at compile-time when
builtin_popcountg() is not available
(see sys/compat/linuxkpi/common/include/linux/bitops.h for LLVM before
19 and gcc before 14).

Obtained from: https://reviews.freebsd.org/D50995#1174884 by obiwac

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 69389
Build 66272: arc lint + arc unit

Event Timeline

bz requested review of this revision.Thu, Dec 18, 10:51 PM
bz created this revision.
bz added a subscriber: emaste.

Adding @emaste as I found @dumbbell 's version through the stack of local changes you carry.

LGTM. Out of paranoia, I verified using compiler explorer that it's reliably const enough to use in a macro even at -O0 with an old clang.

This revision is now accepted and ready to land.Fri, Dec 19, 9:55 AM