Page MenuHomeFreeBSD

random(4): Translate a comment requirement into a compile-time invariant
ClosedPublic

Authored by cem on Sep 1 2018, 4:39 AM.
Tags
None
Referenced Files
F161523061: D16982.id47554.diff
Sat, Jul 4, 12:57 PM
Unknown Object (File)
Sat, Jul 4, 10:17 AM
Unknown Object (File)
Thu, Jul 2, 4:30 AM
Unknown Object (File)
Mon, Jun 22, 3:41 PM
Unknown Object (File)
Sun, Jun 21, 12:36 PM
Unknown Object (File)
Jun 4 2026, 5:58 AM
Unknown Object (File)
May 26 2026, 8:32 AM
Unknown Object (File)
Apr 24 2026, 9:11 PM
Subscribers

Details

Summary

In various places, random represents the set of sources as a 32-bit word
bitmask. It assumes all sources fit within this, i.e., the maximum valid
source number is 31.

There was a comment specifying this limitation, but we can actually refuse
to compile if our assumption is violated instead. We still have a few spare
random source slots, but sooner or later someone may need to convert the
masks used from raw 32-bit words to bitset(9) APIs.

This prevents some kinds of developer foot-shooting when adding new random
sources. No functional change.

Diff Detail

Repository
rS FreeBSD src repository - subversion
Lint
Lint Not Applicable
Unit
Tests Not Applicable