Page MenuHomeFreeBSD

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

Authored by bz on Thu, Dec 18, 10:51 PM.
Tags
None
Referenced Files
F140177108: D54301.id168460.diff
Sun, Dec 21, 3:34 AM
Unknown Object (File)
Fri, Dec 19, 8:29 PM
Unknown Object (File)
Fri, Dec 19, 11:15 AM
Unknown Object (File)
Fri, Dec 19, 7:17 AM
Unknown Object (File)
Fri, Dec 19, 6:32 AM
Unknown Object (File)
Fri, Dec 19, 5:48 AM
Unknown Object (File)
Thu, Dec 18, 11:51 PM
Subscribers

Details

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

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.

Neat tool. Didn't know about that. Thank you!

This revision was automatically updated to reflect the committed changes.