31 Jan
2023
31 Jan
'23
10:10 a.m.
Here is an alternative `RtlUniform` implementation: ``` ULONG WINAPI RtlUniform (PULONG seed) { return *seed = ((ULONGLONG)*seed * 0x7fffffed + 0x7fffffc3) % 0x7fffffff; } ``` The implementation above is equivalent but slightly slower on my x86-64 machine. ``` RtlUniform (Intel i7-1185G7 Tiger Lake, gcc 12.2.1-4.fc36.x86_64, -O2, simple): 5.905s RtlUniform (Intel i7-1185G7 Tiger Lake, gcc 12.2.1-4.fc36.x86_64, -O2, no div): 5.706s ``` -- https://gitlab.winehq.org/wine/wine/-/merge_requests/821#note_22476