On Wed, 23 Jul 2025 at 17:19, 1nfocalypse <[email protected]> wrote: > > Implements Philox Engine (P2075R6) and associated tests. > > Implements additional feedback from v4 from Patrick Palka. > > While fixing the carry bit propagation, I noted an issue for the > limb carry reset as well, which has been fixed, plus I snagged > some accidental whitespace that survived in random.h and > some extra curly braces that made it into v4. > > Otherwise, with regards to the v4 feedback, yes, a fallback for > targets that don't support __uint128_t would be very nice, and > I think doing that as an independent patch is fitting given > Random123 itself demands 128 bit integer support for Philox.
It looks like Random123 supports philox4x32 without 128-bit integers, just not philox4x64. (And unfortunately the standard requires both to work even for 16-bit microcontrollers!) _Select_uint_least_t in bits/random.h should be used to select the type for the intermediate results, so that we don't use int128 for philox4x32 which doesn't require more than uint64_t. With a little bit of work, the fallback impl of _Select_uint_least_t::type for 32-bit targets could support the required 128-bit arithmetic for targets without __int128 support. > > If any further changes need to be made, please let me know. > > Built/tested on x86_64-pc-linux-gnu.
