[libcxx-commits] [libcxx] linear_congruential_engine: add using more precision to prevent overflow (PR #81583)

Mark de Wever via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 3 09:31:38 PST 2024


================
@@ -38,12 +38,12 @@ int main(int, char**)
 
     // m might overflow. The overflow is not OK and result will be in bounds
     // so we should use Schrage's algorithm
-    typedef std::linear_congruential_engine<T, (1ull << 32), 0, (1ull << 63) + 1> E2;
+    typedef std::linear_congruential_engine<T, 0x100000000ull, 0, (1ull << 63) + 1ull> E2;
----------------
mordante wrote:

Why did you change `(1ull << 32)` to `0x100000000ull`?

https://github.com/llvm/llvm-project/pull/81583


More information about the libcxx-commits mailing list