This will allow the code to be reused by the cross-build sys/types.h
wrapper in order to provide the APIs for greater compatibility. This
also provides a path towards eventually removing the definitions from
sys/types.h altogether if so desired by gradually migrating users to
including sys/bitcount.h explicitly, but that is not the primary goal
here.
Details
Diff Detail
- Repository
- rG FreeBSD src repository
- Lint
Lint Not Applicable - Unit
Tests Not Applicable
Event Timeline
sys/sys/bitcount.h | ||
---|---|---|
4–6 | I'm not sure these should have a Regents copyright -- I looked at one example, bitcount16, and it comes from @kib's R10:b03c6795275eb89d06599250d7ebb905417ea172 |
sys/sys/bitcount.h | ||
---|---|---|
4–6 | Happy to trim it to something more appropriate, I just copied it wholesale from sys/sys/types.h given that's where the contents are moved from |
sys/sys/bitcount.h | ||
---|---|---|
4–6 | Yeah - I suspect that when they were added the author(s) did not feel they warranted an addition to the copyright header, but now that they're extracted to a separate file we should clean it up. I'll try to find where they all come from |
sys/sys/bitcount.h | ||
---|---|---|
47 | I was going to suggest using those builtins unconditionally, but it turns out GCC emits a libcall instead of inlining the code: https://godbolt.org/z/cYn6zr6cv ... |
The original version of bitcount32() goes back to commit f1b665c8fe3c87d9baf30ea71abacecb5345238c by @peter. The only material change to that code was a cleanup by @cperciva in 9c518c234b073769063b086103701fdc7e834150. kib added bitcount16(), and I expanded it to cover 64-bit, longs, and ints. None of those have origins in UCB, with the exception that I think @peter might have gotten the original out of a fortune(6) file which indeed might date back to UCB.
If it's going to take a while to figure out what a more precise copyright statement would be, can I please get this committed so we can fix building makefs as a bootstrap tool on non-FreeBSD, with the copyright adjusted as deemed fit post-commit? This is currently preventing cheribuild freebsd-<arch> from working on non-FreeBSD.
I think it's fine to commit as-is.
BTW, the code in fortune that Peter copied was added in this commit (I was 11 years old at the time): https://svnweb.freebsd.org/csrg/games/fortune/datfiles/fortunes?revision=39099&view=markup
I don't think fortune really had a separate license. It probably though was under the UCB umbrella in 4.4Lite.
can I please get this committed so we can fix building makefs as a bootstrap tool on non-FreeBSD
Sure, go ahead. Perhaps just mention in the commit message that you copied the header copyright block from the source file (so that if someone wants to change it in the future it seems reasonable).