Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226766/?format=api
{ "id": 2226766, "url": "http://patchwork.ozlabs.org/api/patches/2226766/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhup2wemv2.gcc.gcc-TEST.redi.81.1.2@forge-stage.sourceware.org/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/projects/17/?format=api", "name": "GNU Compiler Collection", "link_name": "gcc", "list_id": "gcc-patches.gcc.gnu.org", "list_email": "gcc-patches@gcc.gnu.org", "web_url": null, "scm_url": null, "webscm_url": null, "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<bmm.hhup2wemv2.gcc.gcc-TEST.redi.81.1.2@forge-stage.sourceware.org>", "list_archive_url": null, "date": "2026-04-22T18:47:30", "name": "[v1,2/2] philox-edits", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "1508a44fd081f1af00ffaec26439f1beb1154b4f", "submitter": { "id": 93210, "url": "http://patchwork.ozlabs.org/api/people/93210/?format=api", "name": "Jonathan Wakely via Sourceware Forge", "email": "forge-bot+redi@forge-stage.sourceware.org" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/bmm.hhup2wemv2.gcc.gcc-TEST.redi.81.1.2@forge-stage.sourceware.org/mbox/", "series": [ { "id": 501091, "url": "http://patchwork.ozlabs.org/api/series/501091/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501091", "date": "2026-04-22T18:47:29", "name": "WIP: philox", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501091/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226766/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226766/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>", "X-Original-To": [ "incoming@patchwork.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Delivered-To": [ "patchwork-incoming@legolas.ozlabs.org", "gcc-patches@gcc.gnu.org" ], "Authentication-Results": [ "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)", "sourceware.org; dmarc=none (p=none dis=none)\n header.from=forge-stage.sourceware.org", "sourceware.org;\n spf=pass smtp.mailfrom=forge-stage.sourceware.org", "server2.sourceware.org;\n arc=none smtp.remote-ip=38.145.34.39" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g18RS3zdHz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 05:29:08 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id AFC6242939BB\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 19:29:06 +0000 (GMT)", "from forge-stage.sourceware.org (vm08.sourceware.org [38.145.34.39])\n by sourceware.org (Postfix) with ESMTPS id BE2B343413F7\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:48:50 +0000 (GMT)", "from forge-stage.sourceware.org (localhost [IPv6:::1])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256)\n (No client certificate requested)\n by forge-stage.sourceware.org (Postfix) with ESMTPS id 97C4E43546\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 18:48:50 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org AFC6242939BB", "OpenDKIM Filter v2.11.0 sourceware.org BE2B343413F7" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org BE2B343413F7", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org BE2B343413F7", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776883730; cv=none;\n b=rZ2pJgOO5RvoQBS686SrdOfKuz2mShucwlj4VbJSzOMknKmDNGxutJJIB0gGZGhOobeT7Hz90EAXduDEMaPawVCI71Xnv298Nd4OTo82simILsz36J+a9MwEmOy+cwFX3K1FKcd4lonKWIwq0ZdtwoysjwtW35inzT33jdk1Lhk=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776883730; c=relaxed/simple;\n bh=kNsoWPGag22c0nWGvCV4eDbhfD5POaaCgn4TV2+b98w=;\n h=From:Date:Subject:To:Message-ID;\n b=uo34UVJ+SOnUYKSbzRhMhNoYmkWDYrKJKZKVLKtrJubnO6QtMppLqsKyVdwhiO4L5jT3hDv7BgEA1jUNHOyfq5V4q0bIAN8HeMRUpLLk0+yj0CxFP4LzbnQH3iCiqYK3pJYC7ltkZajy3EgGZ8dkY1BaDLCBTltTBfXeiG2A+Fk=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "From": "Jonathan Wakely via Sourceware Forge\n <forge-bot+redi@forge-stage.sourceware.org>", "Date": "Wed, 22 Apr 2026 18:47:30 +0000", "Subject": "[PATCH v1 2/2] philox-edits", "To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>", "Message-ID": "\n <bmm.hhup2wemv2.gcc.gcc-TEST.redi.81.1.2@forge-stage.sourceware.org>", "X-Mailer": "batrachomyomachia", "X-Requested-Reviewer": "ppalka", "X-Pull-Request-Organization": "gcc", "X-Pull-Request-Repository": "gcc-TEST", "X-Pull-Request": "https://forge.sourceware.org/gcc/gcc-TEST/pulls/81", "References": "\n <bmm.hhup2wemv2.gcc.gcc-TEST.redi.81.1.0@forge-stage.sourceware.org>", "In-Reply-To": "\n <bmm.hhup2wemv2.gcc.gcc-TEST.redi.81.1.0@forge-stage.sourceware.org>", "X-Patch-URL": "\n https://forge.sourceware.org/redi/gcc/commit/127a2d600b8f94d289bc386fa105b43d6a030ce3", "X-BeenThere": "gcc-patches@gcc.gnu.org", "X-Mailman-Version": "2.1.30", "Precedence": "list", "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>", "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>", "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>", "List-Post": "<mailto:gcc-patches@gcc.gnu.org>", "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>", "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>", "Reply-To": "gcc-patches mailing list <gcc-patches@gcc.gnu.org>, redi@gcc.gnu.org", "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org" }, "content": "From: Jonathan Wakely <jwakely@redhat.com>\n\nlibstdc++-v3/ChangeLog:\n\n\t* include/bits/random.h:\n\t* include/bits/random.tcc:\n\t* testsuite/26_numerics/random/philox4x32.cc:\n\t* testsuite/26_numerics/random/philox4x64.cc:\n\t* testsuite/26_numerics/random/philox_engine/cons/copy.cc:\n\t* testsuite/26_numerics/random/philox_engine/cons/default.cc:\n\t* testsuite/26_numerics/random/philox_engine/cons/seed.cc:\n\t* testsuite/26_numerics/random/philox_engine/operators/equal.cc:\n\t* testsuite/26_numerics/random/philox_engine/operators/serialize.cc:\n\t* testsuite/26_numerics/random/philox_engine/requirements/constants.cc:\n\t* testsuite/26_numerics/random/philox_engine/requirements/typedefs.cc:\n\t* testsuite/26_numerics/random/philox_engine/cons/119794.cc:\n\tRemoved.\n\t* testsuite/26_numerics/random/philox_engine/cons/seed_seq.cc: Removed.\n\t* testsuite/26_numerics/random/philox_engine/operators/inequal.cc: Removed.\n\t* testsuite/26_numerics/random/philox_engine/requirements/constexpr_data.cc: Removed.\n\t* testsuite/26_numerics/random/philox_engine/requirements/constexpr_functions.cc: Removed.\n---\n libstdc++-v3/include/bits/random.h | 264 ++++++++--------\n libstdc++-v3/include/bits/random.tcc | 282 +++++++-----------\n .../26_numerics/random/philox4x32.cc | 11 +-\n .../26_numerics/random/philox4x64.cc | 11 +-\n .../random/philox_engine/cons/119794.cc | 39 ---\n .../random/philox_engine/cons/copy.cc | 18 +-\n .../random/philox_engine/cons/default.cc | 34 ++-\n .../random/philox_engine/cons/seed.cc | 45 ++-\n .../random/philox_engine/cons/seed_seq.cc | 24 --\n .../random/philox_engine/operators/equal.cc | 11 +-\n .../random/philox_engine/operators/inequal.cc | 30 --\n .../philox_engine/operators/serialize.cc | 7 +-\n .../philox_engine/requirements/constants.cc | 56 ++--\n .../requirements/constexpr_data.cc | 50 ----\n .../requirements/constexpr_functions.cc | 41 ---\n .../philox_engine/requirements/typedefs.cc | 22 +-\n 16 files changed, 386 insertions(+), 559 deletions(-)\n delete mode 100644 libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/119794.cc\n delete mode 100644 libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/seed_seq.cc\n delete mode 100644 libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/inequal.cc\n delete mode 100644 libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constexpr_data.cc\n delete mode 100644 libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constexpr_functions.cc", "diff": "diff --git a/libstdc++-v3/include/bits/random.h b/libstdc++-v3/include/bits/random.h\nindex e74b7bd75c03..4049a77fbf4c 100644\n--- a/libstdc++-v3/include/bits/random.h\n+++ b/libstdc++-v3/include/bits/random.h\n@@ -32,8 +32,8 @@\n #define _RANDOM_H 1\n \n #include <vector>\n+#include <bits/ios_base.h>\n #include <bits/uniform_int_dist.h>\n-#include <iomanip>\n \n namespace std _GLIBCXX_VISIBILITY(default)\n {\n@@ -1689,21 +1689,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n { return !(__lhs == __rhs); }\n #endif\n \n-#if __cpp_lib_philox_engine\n-\n+#if __glibcxx_philox_engine // >= C++26\n /**\n- * @brief: A discrete pseudorandom number generator based off of weakened\n- * cryptographic primitives.\n+ * @brief A discrete pseudorandom number generator with weak cryptographic\n+ * properties\n+ *\n+ * This algorithm was designed to be used for highly parallel random number\n+ * generation, and is capable of immensely long periods. It provides\n+ * \"Crush-resistance\", denoting an ability to pass the TestU01 Suite's\n+ * \"Big Crush\" test, demonstrating significant apparent entropy.\n *\n- * This algorithm was intended to be used for highly parallel random number\n- * generation, and is capable of immensely long periods. It provides \"Crush-\n- * resistance\", denoting an ability to pass the TestU01 Suite's \"Big Crush\"\n- * test, demonstrating significant apparent entropy. It is not intended for\n- * cryptographic use and should not be used for such, despite being based on\n- * cryptographic primitives.\n+ * It is not intended for cryptographic use and should not be used for such,\n+ * despite being based on cryptographic primitives.\n *\n- * The two four-word definitions are likely the best use for this algorithm,\n- * and are given below as defaults.\n+ * The typedefs `philox4x32` and `philox4x64` are provided as suitable\n+ * defaults for most use cases, providing high-quality random numbers\n+ * with reasonable performance.\n *\n * This algorithm was created by John Salmon, Mark Moraes, Ron Dror, and\n * David Shaw as a product of D.E. Shaw Research.\n@@ -1717,9 +1718,8 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n * @headerfile random\n * @since C++26\n */\n- template<class _UIntType, size_t __w,\n-\t size_t __n, size_t __r,\n-\t _UIntType... __consts>\n+ template<typename _UIntType, size_t __w, size_t __n, size_t __r,\n+\t _UIntType... __consts>\n class philox_engine\n {\n static_assert(__n == 2 || __n == 4,\n@@ -1729,42 +1729,40 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n static_assert(0 < __r, \"a number of rounds must be specified\");\n static_assert((0 < __w && __w <= numeric_limits<_UIntType>::digits),\n \t \"specified bitlength must match input type\");\n+\n template<typename _Sseq>\n-\tusing _If_seed_seq\n-\t = __detail::_If_seed_seq_for<_Sseq, philox_engine, _UIntType>;\n+\tstatic constexpr bool __is_seed_seq = requires {\n+\t typename __detail::_If_seed_seq_for<_Sseq, philox_engine, _UIntType>;\n+\t};\n \n- private:\n-\t// the ordering here is essential to functionality.\n-\t/** @brief an internal unpacking function for %philox_engine. */\n-\ttemplate <size_t __ind0, size_t __ind1>\n-\t static constexpr\n-\t array<_UIntType, __n / 2>\n-\t _S_popArray()\n-\t {\n-\t if constexpr (__n == 4)\n-\t return {__consts...[__ind0], __consts...[__ind1]};\n-\t else\n-\t return {__consts...[__ind0]};\n-\t }\n+ template <size_t __ind0, size_t __ind1>\n+\tstatic constexpr\n+\tarray<_UIntType, __n / 2>\n+\t_S_popArray()\n+\t{\n+\t if constexpr (__n == 4)\n+\t return {__consts...[__ind0], __consts...[__ind1]};\n+\t else\n+\t return {__consts...[__ind0]};\n+\t}\n \n public:\n-\t/** Type of template param. */\n \tusing result_type = _UIntType;\n \t// public members\n \tstatic constexpr size_t word_size = __w;\n \tstatic constexpr size_t word_count = __n;\n \tstatic constexpr size_t round_count = __r;\n-\tstatic constexpr array<result_type, __n / 2> multipliers =\n-\t philox_engine::_S_popArray<0,2>();\n-\tstatic constexpr array<result_type, __n / 2> round_consts =\n-\t philox_engine::_S_popArray<1,3>();\n+\tstatic constexpr array<result_type, __n / 2> multipliers\n+\t = _S_popArray<0,2>();\n+\tstatic constexpr array<result_type, __n / 2> round_consts\n+\t = _S_popArray<1,3>();\n \n-\t/** @brief returns the minimum value possible. */\n+\t/// The minimum value that this engine can return\n \tstatic constexpr result_type\n \tmin()\n \t{ return 0; }\n \n-\t/** @brief returns the maximum value possible. */\n+\t/// The maximum value that this engine can return\n \tstatic constexpr result_type\n \tmax()\n \t{\n@@ -1776,16 +1774,18 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t// constructors\n \tphilox_engine()\n \t: philox_engine(default_seed)\n-\t{}\n+\t{ }\n \n \texplicit\n-\tphilox_engine(result_type __value);\n+\tphilox_engine(result_type __value)\n+\t: _M_x{}, _M_y{}, _M_k{}, _M_i(__n - 1)\n+\t{ _M_k[0] = __value & max(); }\n \n \t/** @brief seed sequence constructor for %philox_engine\n \t *\n-\t * @params __q the seed sequence\n+\t * @param __q the seed sequence\n \t */\n-\ttemplate<typename _Sseq, typename = _If_seed_seq<_Sseq>>\n+\ttemplate<typename _Sseq> requires __is_seed_seq<_Sseq>\n \t explicit\n \t philox_engine(_Sseq& __q)\n \t {\n@@ -1793,56 +1793,64 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t }\n \n \tvoid\n-\tseed(result_type value = default_seed);\n+\tseed(result_type __value = default_seed)\n+\t{\n+\t _M_x = {};\n+\t _M_y = {};\n+\t _M_k = {};\n+\t _M_k[0] = __value & max();\n+\t _M_i = __n - 1;\n+\t}\n \n \t/** @brief seeds %philox_engine by seed sequence\n \t *\n-\t * @params __q the seed sequence\n+\t * @param __q the seed sequence\n \t */\n \ttemplate<typename _Sseq>\n-\t _If_seed_seq<_Sseq>\n-\t seed(_Sseq& __q);\n+\t void\n+\t seed(_Sseq& __q) requires __is_seed_seq<_Sseq>;\n \n \t/** @brief sets the internal counter \"cleartext\"\n \t *\n-\t * @params __counter std::array of len N\n+\t * @param __counter std::array of len N\n \t */\n \tvoid\n-\tset_counter(const array<result_type, __n>& __counter);\n+\tset_counter(const array<result_type, __n>& __counter)\n+\t{\n+\t for (size_t __j = 0; __j < __n; ++__j)\n+\t _M_x[__j] = __counter[__n - 1 - __j] & max();\n+\t _M_i = __n - 1;\n+\t}\n \n \t/** @brief compares two %philox_engine objects\n \t *\n-\t * @params __x A %philox_engine object\n-\t * @params __y A %philox_engine object\n-\t *\n-\t * @returns true if the objects will produce an identical stream, false\n-\t * otherwise\n+\t * @returns true if the objects will produce an identical stream,\n+\t * false otherwise\n \t */\n \tfriend bool\n-\toperator==(const philox_engine& __x, const philox_engine& __y)\n-\t{\n-\t return (std::equal(__x._M_x.begin(), __x._M_x.end(),\n-\t\t__y._M_x.begin(), __y._M_x.end())\n-\t && std::equal(__x._M_y.begin(), __x._M_y.end(),\n-\t\t__y._M_y.begin(), __y._M_y.end())\n-\t && std::equal(__x._M_k.begin(), __x._M_k.end(),\n-\t\t__y._M_k.begin(), __y._M_k.end())\n-\t && __x._M_i == __y._M_i);\n-\t}\n+\toperator==(const philox_engine&, const philox_engine&) = default;\n \n \t/** @brief outputs a single w-bit number and handles state advancement\n \t *\n \t * @returns return_type\n \t */\n-\t_UIntType\n-\toperator()();\n+\tresult_type\n+\toperator()()\n+\t{\n+\t _M_transition();\n+\t return _M_y[_M_i];\n+\t}\n \n \t/** @brief discards __z numbers\n \t *\n-\t * @params __z number of iterations to discard\n+\t * @param __z number of iterations to discard\n \t */\n \tvoid\n-\tdiscard(unsigned long long __z);\n+\tdiscard(unsigned long long __z)\n+\t{\n+\t while (__z--)\n+\t _M_transition();\n+\t}\n \n \t/** @brief outputs the state of the generator\n \t *\n@@ -1853,22 +1861,23 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t */\n \ttemplate<typename _CharT, typename _Traits>\n \t friend basic_ostream<_CharT, _Traits>&\n-\t operator<<(basic_ostream<_CharT, _Traits>& __os,\n-\t const philox_engine& __x)\n-\t {\n-\t\tconst typename ios_base::fmtflags __flags = __os.flags();\n-\t\tconst _CharT __fill = __os.fill();\n-\t\t__os.flags(ios_base::dec | ios_base::left);\n-\t\t__os.fill(__os.widen(' '));\n-\t\tfor (auto &__subkey : __x._M_k)\n-\t\t __os << __subkey << ' ';\n-\t\tfor (auto &__ctr : __x._M_x)\n-\t\t __os << __ctr << ' ';\n-\t\t__os << __x._M_i;\n-\t\t__os.flags(__flags);\n-\t\t__os.fill(__fill);\n-\t\treturn __os;\n-\t }\n+\t operator<<(basic_ostream<_CharT, _Traits>& __os,\n+\t\t const philox_engine& __x)\n+\t {\n+\t const typename ios_base::fmtflags __flags = __os.flags();\n+\t const _CharT __fill = __os.fill();\n+\t __os.flags(ios_base::dec | ios_base::left);\n+\t _CharT __space = __os.widen(' ');\n+\t __os.fill(__space);\n+\t for (auto& __subkey : __x._M_k)\n+\t __os << __subkey << __space;\n+\t for (auto& __ctr : __x._M_x)\n+\t __os << __ctr << __space;\n+\t __os << __x._M_i;\n+\t __os.flags(__flags);\n+\t __os.fill(__fill);\n+\t return __os;\n+\t }\n \n \t/** @brief takes input to set the state of the %philox_engine object\n \t *\n@@ -1879,38 +1888,39 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \t */\n \ttemplate <typename _CharT, typename _Traits>\n \t friend basic_istream<_CharT, _Traits>&\n-\t operator>>(basic_istream<_CharT, _Traits>& __is,\n-\t philox_engine& __x)\n+\t operator>>(basic_istream<_CharT, _Traits>& __is,\n+\t\t philox_engine& __x)\n+\t {\n+\t const typename ios_base::fmtflags __flags = __is.flags();\n+\t __is.flags(ios_base::dec | ios_base::skipws);\n+\t for (auto& __subkey : __x._M_k)\n+\t __is >> __subkey;\n+\t for (auto& __ctr : __x._M_x)\n+\t __is >> __ctr;\n+\t array<_UIntType, __n> __tmpCtr = __x._M_x;\n+\t unsigned char __setIndex = 0;\n+\t for (size_t __j = 0; __j < __x._M_x.size(); ++__j)\n \t {\n-\t\tconst typename ios_base::fmtflags __flags = __is.flags();\n-\t\t__is.flags(ios_base::dec | ios_base::skipws);\n-\t\tfor (auto &__subkey : __x._M_k)\n-\t\t __is >> __subkey;\n-\t\tfor (auto &__ctr : __x._M_x)\n-\t\t __is >> __ctr;\n-\t\tarray<_UIntType, __n> __tmpCtr = __x._M_x;\n-\t\tunsigned char __setIndex = 0;\n-\t\tfor (size_t __j = 0; __j < __x._M_x.size(); ++__j)\n-\t\t{\n-\t\t if (__x._M_x[__j] > 0)\n+\t\tif (__x._M_x[__j] > 0)\n \t\t {\n \t\t __setIndex = __j;\n \t\t break;\n \t\t }\n-\t\t}\n-\t\tfor (size_t __j = 0; __j <= __setIndex; ++__j)\n-\t\t{\n-\t\t if (__j != __setIndex)\n-\t\t __x._M_x[__j] = max();\n-\t\t else\n-\t\t --__x._M_x[__j];\n-\t\t}\n-\t\t__x._M_philox();\n-\t\t__x._M_x = __tmpCtr;\n-\t\t__is >> __x._M_i;\n-\t\t__is.flags(__flags);\n-\t\treturn __is;\n \t }\n+\t for (size_t __j = 0; __j <= __setIndex; ++__j)\n+\t {\n+\t\tif (__j != __setIndex)\n+\t\t __x._M_x[__j] = max();\n+\t\telse\n+\t\t --__x._M_x[__j];\n+\t }\n+\t __x._M_philox();\n+\t __x._M_x = __tmpCtr;\n+\t __is >> __x._M_i;\n+\t __is.flags(__flags);\n+\t return __is;\n+\t }\n+\n private:\n \t// private state variables\n \tarray<_UIntType, __n> _M_x;\n@@ -1918,39 +1928,22 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \tarray<_UIntType, __n> _M_y;\n \tunsigned long long _M_i = 0;\n \n-\t/** @brief Takes the high values of the product of __a, __b\n-\t *\n-\t * @params __a an unsigned integer\n-\t * @params __b an unsigned integer\n-\t *\n-\t * @returns an unsigned integer of at most bitlength W\n-\t */\n-\tstatic\n-\t_UIntType\n+\t// The high W bits of the product of __a and __b\n+\tstatic _UIntType\n \t_S_mulhi(_UIntType __a, _UIntType __b); // (A*B)/2^W\n \n-\t/** @brief Takes the low values of the product of __a, __b\n-\t *\n-\t * @params __a an unsigned integer\n-\t * @params __b an unsigned integer\n-\t *\n-\t * @returns an unsigned integer of at most bitlength W\n-\t */\n-\tstatic\n-\t_UIntType\n+\t// The low W bits of the product of __a and __b\n+\tstatic _UIntType\n \t_S_mullo(_UIntType __a, _UIntType __b); // (A*B)%2^W\n \n-\t/** @brief an R-round substitution/Feistel Network hybrid for\n-\t * %philox_engine\n-\t */\n+\t// An R-round substitution/Feistel Network hybrid for philox_engine\n \tvoid\n \t_M_philox();\n \n-\t/** @brief an internal transition function for the %philox_engine. */\n+\t// The transition function\n \tvoid\n \t_M_transition();\n };\n-\n #endif\n \n /**\n@@ -2007,17 +2000,16 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n \n typedef minstd_rand0 default_random_engine;\n \n-#if __cpp_lib_philox_engine\n+#if __glibcxx_philox_engine\n \n+ /// 32-bit four-word Philox engine.\n typedef philox_engine<\n uint_fast32_t,\n 32, 4, 10,\n 0xCD9E8D57, 0x9E3779B9,\n 0xD2511F53, 0xBB67AE85> philox4x32;\n \n- /**\n- * Alternative Philox instance (64 bit)\n- */\n+ /// 64-bit four-word Philox engine.\n typedef philox_engine<\n uint_fast64_t,\n 64, 4, 10,\ndiff --git a/libstdc++-v3/include/bits/random.tcc b/libstdc++-v3/include/bits/random.tcc\nindex 53f302da8007..f4b9778e468e 100644\n--- a/libstdc++-v3/include/bits/random.tcc\n+++ b/libstdc++-v3/include/bits/random.tcc\n@@ -907,197 +907,129 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION\n return __is;\n }\n \n-#if __cpp_lib_philox_engine\n-\n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- _UIntType\n- philox_engine<_UIntType,\n- __w, __n, __r, __consts...>::_S_mulhi(_UIntType __a, _UIntType __b)\n- {\n- const __uint128_t __num =\n-\tstatic_cast<__uint128_t>(__a) * static_cast<__uint128_t>(__b);\n- return static_cast<_UIntType>((__num >> __w) & max());\n- }\n+#if __glibcxx_philox_engine // >= C++26\n \n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- _UIntType\n- philox_engine<_UIntType,\n- __w, __n, __r, __consts...>::_S_mullo(_UIntType __a, _UIntType __b)\n- {\n- return static_cast<_UIntType>((__a * __b) & max());\n- }\n+ template<typename _UIntType, size_t __w, size_t __n, size_t __r,\n+\t _UIntType... __consts>\n+ _UIntType\n+ philox_engine<_UIntType, __w, __n, __r, __consts...>::\n+ _S_mulhi(_UIntType __a, _UIntType __b)\n+ {\n+ const __uint128_t __num =\n+\t static_cast<__uint128_t>(__a) * static_cast<__uint128_t>(__b);\n+ return static_cast<_UIntType>((__num >> __w) & max());\n+ }\n \n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- void\n- philox_engine<_UIntType, __w, __n, __r, __consts...>::_M_transition()\n- {\n- ++_M_i;\n- if (_M_i == __n)\n+ template<typename _UIntType, size_t __w, size_t __n, size_t __r,\n+\t _UIntType... __consts>\n+ _UIntType\n+ philox_engine<_UIntType, __w, __n, __r, __consts...>::\n+ _S_mullo(_UIntType __a, _UIntType __b)\n {\n+ return static_cast<_UIntType>((__a * __b) & max());\n+ }\n+\n+ template<typename _UIntType, size_t __w, size_t __n, size_t __r,\n+\t _UIntType... __consts>\n+ void\n+ philox_engine<_UIntType, __w, __n, __r, __consts...>::_M_transition()\n+ {\n+ ++_M_i;\n+ if (_M_i != __n)\n+\treturn;\n+\n _M_philox();\n if constexpr (__n == 4)\n- {\n-\t__uint128_t __uh =\n-\t (static_cast<__uint128_t>(_M_x[1]) << __w)\n-\t\t| (static_cast<__uint128_t>(_M_x[0]) + 1);\n-\t__uint128_t __lh =\n-\t ((static_cast<__uint128_t>(_M_x[3]) << __w)\n-\t\t| (_M_x[2]));\n-\t__uint128_t __bigMask =\n-\t (static_cast<__uint128_t>(1) << ((2 * __w) - 1))\n-\t | ((static_cast<__uint128_t>(1) << ((2 * __w) - 1)) - 1);\n-\tif ((__uh & __bigMask) == 0)\n \t{\n-\t ++__lh;\n-\t __uh = 0;\n+\t __uint128_t __uh =\n+\t (static_cast<__uint128_t>(_M_x[1]) << __w)\n+\t\t | (static_cast<__uint128_t>(_M_x[0]) + 1);\n+\t __uint128_t __lh =\n+\t ((static_cast<__uint128_t>(_M_x[3]) << __w)\n+\t\t | (_M_x[2]));\n+\t __uint128_t __bigMask =\n+\t (static_cast<__uint128_t>(1) << ((2 * __w) - 1))\n+\t\t | ((static_cast<__uint128_t>(1) << ((2 * __w) - 1)) - 1);\n+\t if ((__uh & __bigMask) == 0)\n+\t {\n+\t ++__lh;\n+\t __uh = 0;\n+\t }\n+\t _M_x[0] = __uh & max();\n+\t _M_x[1] = (__uh >> (__w)) & max();\n+\t _M_x[2] = __lh & max();\n+\t _M_x[3] = (__lh >> (__w)) & max();\n+\t}\n+ else\n+\t{\n+\t __uint128_t __num =\n+\t\t (static_cast<__uint128_t>(_M_x[1]) << __w)\n+\t\t | (static_cast<__uint128_t>(_M_x[0]) + 1);\n+\t _M_x[0] = __num & max();\n+\t _M_x[1] = (__num >> __w) & max();\n \t}\n-\t_M_x[0] = __uh & max();\n-\t_M_x[1] = (__uh >> (__w)) & max();\n-\t_M_x[2] = __lh & max();\n-\t_M_x[3] = (__lh >> (__w)) & max();\n- } else\n- {\n-\t__uint128_t __num =\n-\t\t(static_cast<__uint128_t>(_M_x[1]) << __w)\n-\t\t| (static_cast<__uint128_t>(_M_x[0]) + 1);\n-\t_M_x[0] = __num & max();\n-\t_M_x[1] = (__num >> __w) & max();\n- }\n _M_i = 0;\n }\n- }\n \n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- void\n- philox_engine<_UIntType, __w, __n, __r, __consts...>::_M_philox()\n- {\n- array<_UIntType, __n> __outputSeq{};\n- for (size_t __j = 0; __j < __n; ++__j)\n- __outputSeq[__j] = _M_x[__j];\n- for (unsigned long __j = 0; __j < __r; ++__j)\n+ template<typename _UIntType, size_t __w, size_t __n, size_t __r,\n+\t _UIntType... __consts>\n+ void\n+ philox_engine<_UIntType, __w, __n, __r, __consts...>::_M_philox()\n {\n- array<_UIntType, __n> __intermedSeq{};\n- if constexpr (__n == 4)\n- {\n-\t__intermedSeq[0] = __outputSeq[2];\n-\t__intermedSeq[1] = __outputSeq[1];\n-\t__intermedSeq[2] = __outputSeq[0];\n-\t__intermedSeq[3] = __outputSeq[3];\n- } else\n- {\n-\t__intermedSeq[0] = __outputSeq[0];\n-\t__intermedSeq[1] = __outputSeq[1];\n- }\n- for (unsigned long __k = 0; __k < (__n/2); ++__k)\n- {\n-\t__outputSeq[2*__k]= _S_mulhi(__intermedSeq[2*__k], multipliers[__k])\n-\t ^ (((_M_k[__k] + (__j * round_consts[__k])) & max()))\n-\t ^ __intermedSeq[2*__k+1];\n+ array<_UIntType, __n> __outputSeq = _M_x;\n+ for (size_t __j = 0; __j < __r; ++__j)\n+\t{\n+\t array<_UIntType, __n> __intermedSeq{};\n+\t if constexpr (__n == 4)\n+\t {\n+\t __intermedSeq[0] = __outputSeq[2];\n+\t __intermedSeq[1] = __outputSeq[1];\n+\t __intermedSeq[2] = __outputSeq[0];\n+\t __intermedSeq[3] = __outputSeq[3];\n+\t }\n+\t else\n+\t {\n+\t __intermedSeq[0] = __outputSeq[0];\n+\t __intermedSeq[1] = __outputSeq[1];\n+\t }\n+\t for (unsigned long __k = 0; __k < (__n/2); ++__k)\n+\t {\n+\t __outputSeq[2*__k]\n+\t\t= _S_mulhi(__intermedSeq[2*__k], multipliers[__k])\n+\t\t ^ (((_M_k[__k] + (__j * round_consts[__k])) & max()))\n+\t\t ^ __intermedSeq[2*__k+1];\n \n-\t__outputSeq[(2*__k)+1]= _S_mullo(__intermedSeq[2*__k],\n-\t multipliers[__k]);\n- }\n+\t __outputSeq[(2*__k)+1]\n+\t\t= _S_mullo(__intermedSeq[2*__k], multipliers[__k]);\n+\t }\n+\t}\n+ _M_y = __outputSeq;\n }\n- for (unsigned long __j = 0; __j < __n; ++__j)\n- _M_y[__j] = __outputSeq[__j];\n- }\n-\n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- philox_engine<_UIntType,\n-\t__w, __n, __r, __consts...>::philox_engine(result_type __value)\n- {\n- std::fill(_M_x.begin(), _M_x.end(), 0);\n- std::fill(_M_k.begin(), _M_k.end(), 0);\n- std::fill(_M_y.begin(), _M_y.end(), 0);\n- _M_k[0] = __value & max();\n- _M_i = __n - 1;\n- }\n \n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- void\n- philox_engine<_UIntType,\n- __w, __n, __r, __consts...>::seed(result_type __value)\n- {\n- std::fill(_M_x.begin(), _M_x.end(), 0);\n- std::fill(_M_k.begin(), _M_k.end(), 0);\n- std::fill(_M_y.begin(), _M_y.end(), 0);\n- _M_k[0] = __value & max();\n- _M_i = __n - 1;\n- }\n-\n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- void\n- philox_engine<_UIntType, __w,\n- __n, __r, __consts...>::set_counter(const array<result_type, __n>& __counter)\n- {\n- for (unsigned long long __j = 0; __j < __n; ++__j)\n- _M_x[__j] = __counter[__n - 1 - __j] & max();\n- _M_i = __n - 1;\n- }\n-\n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n+ template<typename _UIntType, size_t __w, size_t __n, size_t __r,\n+\t _UIntType... __consts>\n template<typename _Sseq>\n- auto\n- philox_engine<_UIntType, __w, __n, __r, __consts...>::seed(_Sseq& __q)\n- -> _If_seed_seq<_Sseq>\n- {\n- std::fill(_M_k.begin(), _M_k.end(), 0);\n- const unsigned long long __p = 1 + ((__w - 1)/ 32);\n- uint_least32_t __tmpArr[(__n / 2) * __p];\n- __q.generate(__tmpArr + 0, __tmpArr + ((__n / 2) *__p));\n- for (unsigned long long __k = 0; __k < (__n/2); ++__k)\n- {\n- unsigned long long __precalc = 0;\n- for (unsigned long long __j = 0; __j < __p; ++__j)\n- {\n-\tunsigned long long __multiplicand = (1ull << (32 * __j));\n-\t__precalc += (__tmpArr[__k*__p + __j] * __multiplicand) & max();\n- }\n- _M_k[__k] = __precalc;\n- }\n- std::fill(_M_x.begin(), _M_x.end(), 0);\n- std::fill(_M_y.begin(), _M_y.end(), 0);\n- _M_i = __n - 1;\n- }\n-\n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- void\n- philox_engine<_UIntType,\n-\t__w, __n, __r, __consts...>::discard(unsigned long long __z)\n- {\n- for (unsigned long long __j = 0; __j < __z; ++__j)\n- _M_transition();\n- }\n-\n- template<class _UIntType,\n-\tsize_t __w, size_t __n,\n-\tsize_t __r, _UIntType... __consts>\n- _UIntType\n- philox_engine<_UIntType, __w, __n, __r, __consts...>::operator()()\n- {\n- _M_transition();\n- return _M_y[_M_i];\n- }\n+ void\n+ philox_engine<_UIntType, __w, __n, __r, __consts...>::seed(_Sseq& __q)\n+ requires __is_seed_seq<_Sseq>\n+ {\n+ seed(0);\n \n-#endif\n+ const unsigned __p = 1 + ((__w - 1) / 32);\n+ uint_least32_t __tmpArr[(__n/2) * __p];\n+ __q.generate(__tmpArr + 0, __tmpArr + ((__n/2) * __p));\n+ for (unsigned __k = 0; __k < (__n/2); ++__k)\n+\t{\n+\t unsigned long long __precalc = 0;\n+\t for (unsigned __j = 0; __j < __p; ++__j)\n+\t {\n+\t unsigned long long __multiplicand = (1ull << (32 * __j));\n+\t __precalc += (__tmpArr[__k * __p + __j] * __multiplicand) & max();\n+\t }\n+\t _M_k[__k] = __precalc;\n+\t}\n+ }\n+#endif // philox_engine\n \n template<typename _IntType, typename _CharT, typename _Traits>\n std::basic_ostream<_CharT, _Traits>&\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox4x32.cc b/libstdc++-v3/testsuite/26_numerics/random/philox4x32.cc\nindex d5a8ca078eff..33842bb8db03 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox4x32.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox4x32.cc\n@@ -1,12 +1,16 @@\n // { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n+// N5014 29.5.6 Engines and engine adaptors with predefined parameters\n \n #include <random>\n #include <testsuite_hooks.h>\n \n+using test_type = std::philox_engine<std::uint_fast32_t, 32, 4, 10,\n+\t\t\t\t 0xCD9E8D57, 0x9E3779B9,\n+\t\t\t\t 0xD2511F53, 0xBB67AE85>;\n+static_assert( std::is_same_v<test_type, std::philox4x32> );\n+\n void\n test01()\n {\n@@ -19,5 +23,4 @@ test01()\n int main()\n {\n test01();\n- return 0;\n }\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox4x64.cc b/libstdc++-v3/testsuite/26_numerics/random/philox4x64.cc\nindex 131f094cb287..11a5691804e0 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox4x64.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox4x64.cc\n@@ -1,12 +1,16 @@\n // { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n+// N5014 29.5.6 Engines and engine adaptors with predefined parameters\n \n #include <random>\n #include <testsuite_hooks.h>\n \n+using test_type = std::philox_engine<std::uint_fast64_t, 64, 4, 10,\n+\t\t\t\t 0xCA5A826395121157, 0x9E3779B97F4A7C15,\n+\t\t\t\t 0xD2E7470EE14C6C93, 0xBB67AE8584CAA73B>;\n+static_assert( std::is_same_v<test_type, std::philox4x64> );\n+\n void\n test01()\n {\n@@ -19,5 +23,4 @@ test01()\n int main()\n {\n test01();\n- return 0;\n }\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/119794.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/119794.cc\ndeleted file mode 100644\nindex c3a5a0eb7545..000000000000\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/119794.cc\n+++ /dev/null\n@@ -1,39 +0,0 @@\n-// { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n-\n-#include <random>\n-#include <testsuite_hooks.h>\n-\n-int f(int x)\n-{\n- std::seed_seq sq(&x, &x + 1);\n- auto rnd = std::philox4x32(sq);\n- return std::uniform_int_distribution<int>()(rnd);\n-}\n-\n-int g(int x)\n-{\n- std::seed_seq sq(&x, &x + 1);\n- auto rnd = std::philox4x32();\n- rnd.seed(sq);\n- return std::uniform_int_distribution<int>()(rnd);\n-}\n-\n-void test01()\n-{\n- const int f1 = f(0);\n- const int f2 = f(0);\n-\n- const int g1 = g(0);\n- const int g2 = g(0);\n-\n- VERIFY( f1 == f2 );\n- VERIFY( g1 == g2 );\n- VERIFY( f1 == g1 );\n-}\n-\n-int main()\n-{\n- test01();\n- return 0;\n-}\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/copy.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/copy.cc\nindex 4f61928a1575..163aec082332 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/copy.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/copy.cc\n@@ -1,25 +1,27 @@\n // { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n+// N5014 29.5.4 Random Number Engine Class Templates\n+// N5014 29.5.4.5 Class Template philox_engine\n \n #include <random>\n+#include <testsuite_hooks.h>\n \n void\n-test01()\n+test01(unsigned long seed)\n {\n \n std::philox_engine<std::uint_fast32_t, 32, 4, 10, 0xCD9E8D57,\n-\t0x9E3779B9, 0xD2511F53, 0xBB67AE85> e(1ul);\n+\t0x9E3779B9, 0xD2511F53, 0xBB67AE85> e(seed);\n \n const auto f(e);\n+ VERIFY( f == e );\n auto g(f);\n- g = g; // Suppress unused warning\n+ VERIFY( g == f );\n }\n \n int main()\n {\n- test01();\n- return 0;\n+ test01(1ul);\n+ test01(111ul);\n }\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/default.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/default.cc\nindex 9f9ae94db0f3..183ca8201093 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/default.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/default.cc\n@@ -1,14 +1,13 @@\n // { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n+// N5014 29.5.4.5 Class Template philox_engine\n \n #include <random>\n #include <testsuite_hooks.h>\n \n void\n-test01()\n+test_default_ctor()\n {\n std::philox_engine<std::uint_fast32_t,\n \t\t 32, 4, 10, 0xCD9E8D57,\n@@ -20,8 +19,31 @@ test01()\n VERIFY( philox4x32nullkey() == 0x6627e8d5ul );\n }\n \n+void\n+test_seed()\n+{\n+ unsigned long seed = 2;\n+ std::philox4x32 seeded(seed);\n+\n+ std::philox4x32 default_init;\n+ VERIFY( seeded != default_init );\n+\n+ std::philox4x32 default_seeded(std::philox4x32::default_seed);\n+ VERIFY( default_seeded == default_init );\n+}\n+\n+void\n+test_seed_seq()\n+{\n+ std::seed_seq sseq{ 1, 2, 3, 4 };\n+ std::philox4x32 seeded(sseq);\n+ std::philox4x32 default_init;\n+ VERIFY( seeded != default_init );\n+}\n+\n int main()\n {\n- test01();\n- return 0;\n+ test_default_ctor();\n+ test_seed();\n+ test_seed_seq();\n }\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/seed.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/seed.cc\nindex 5cb914f4b45c..2b667b233644 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/seed.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/seed.cc\n@@ -1,20 +1,51 @@\n // { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n #include <random>\n+#include <testsuite_hooks.h>\n+\n+int f(int x)\n+{\n+ std::seed_seq sq(&x, &x + 1);\n+ auto rnd = std::philox4x32(sq);\n+ return std::uniform_int_distribution<int>()(rnd);\n+}\n+\n+int g(int x)\n+{\n+ std::seed_seq sq(&x, &x + 1);\n+ auto rnd = std::philox4x32();\n+ rnd.seed(sq);\n+ return std::uniform_int_distribution<int>()(rnd);\n+}\n \n void\n test01()\n {\n- unsigned long seed = 2;\n- std::philox_engine<std::uint_fast32_t,\n-\t\t 32, 4, 10, 0xCD9E8D57,\n-\t\t 0x9E3779B9, 0xD2511F53,\n-\t\t 0xBB67AE85> philox4x32seeded(seed);\n+ const int f1 = f(0);\n+ const int f2 = f(0);\n+\n+ const int g1 = g(0);\n+ const int g2 = g(0);\n+\n+ VERIFY( f1 == f2 );\n+ VERIFY( g1 == g2 );\n+ VERIFY( f1 == g1 );\n+}\n+\n+void\n+test02()\n+{\n+ std::philox4x64 e1(25);\n+ std::philox4x64 e2;\n+ VERIFY( e2 != e1 );\n+ e2.seed(25);\n+ VERIFY( e2 == e1 );\n+\n }\n \n int main()\n {\n test01();\n- return 0;\n+ test02();\n }\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/seed_seq.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/seed_seq.cc\ndeleted file mode 100644\nindex 7d9e3e6540d2..000000000000\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/cons/seed_seq.cc\n+++ /dev/null\n@@ -1,24 +0,0 @@\n-// { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n-\n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n-\n-#include <random>\n-\n-void\n-test01()\n-{\n- std::seed_seq sseq{ 1, 2, 3, 4 };\n- std::philox_engine<std::uint_fast32_t,\n-\t\t 32, 4, 10, 0xCD9E8D57,\n-\t\t 0x9E3779B9, 0xD2511F53,\n-\t\t 0xBB67AE85> philox4x32sseq(sseq);\n-}\n-\n-int\n-main()\n-{\n- test01();\n- return 0;\n-}\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/equal.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/equal.cc\nindex 4f62bfbbd88e..cca1654603ef 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/equal.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/equal.cc\n@@ -1,8 +1,7 @@\n // { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n+// N5014 29.5.4.5 Class Template philox_engine\n \n #include <random>\n #include <testsuite_hooks.h>\n@@ -20,11 +19,15 @@ test01()\n y.discard(100);\n \n VERIFY (x == y);\n+\n+ x.discard(2);\n+ VERIFY (x != y);\n+ y.discard(2);\n+ VERIFY (x == y);\n }\n \n int\n main()\n {\n test01();\n- return 0;\n }\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/inequal.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/inequal.cc\ndeleted file mode 100644\nindex 86d757db9040..000000000000\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/inequal.cc\n+++ /dev/null\n@@ -1,30 +0,0 @@\n-// { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n-\n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n-\n-#include <random>\n-#include <testsuite_hooks.h>\n-\n-void\n-test01()\n-{\n- std::philox_engine<std::uint_fast32_t,\n-\t\t 32, 4, 10, 0xCD9E8D57,\n-\t\t 0x9E3779B9, 0xD2511F53,\n-\t\t 0xBB67AE85> x, y;\n-\n- VERIFY ( !(x != y) );\n- x.discard(100);\n- y.discard(100);\n-\n- VERIFY ( !(x != y) );\n-}\n-\n-int\n-main()\n-{\n- test01();\n- return 0;\n-}\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/serialize.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/serialize.cc\nindex bec4b1725127..4bd40e74a6b5 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/serialize.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/operators/serialize.cc\n@@ -1,13 +1,11 @@\n // { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n+// N5014 29.5.4.5 Class Template philox_engine\n \n #include <sstream>\n #include <random>\n #include <testsuite_hooks.h>\n-#include <iostream>\n \n void\n test01()\n@@ -45,5 +43,4 @@ int\n main()\n {\n test01();\n- return 0;\n }\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constants.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constants.cc\nindex c242056e0a4b..a3cb24eb0667 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constants.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constants.cc\n@@ -1,26 +1,48 @@\n-// { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n+// { dg-do compile { target c++26 } }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n+// N5014 29.5.4.5 Class Template philox_engine\n \n #include <random>\n \n-void test01()\n+namespace test1\n {\n- std::philox4x32 philox;\n- const void* p = &philox.word_size;\n- p = &philox.word_count;\n- p = &philox.round_count;\n- p = &philox.multipliers;\n- p = &philox.round_consts;\n- p = &philox.default_seed;\n- p = p; // Suppress unused warning.\n+ using P = std::philox_engine<std::uint32_t, 32, 4, 5, 9, 99, 999, 9999>;\n+ constexpr std::same_as<std::uint32_t> auto min = P::min();\n+ static_assert( min == 0 );\n+ constexpr std::same_as<std::uint32_t> auto max = P::max();\n+ static_assert( max == 0xffffffff );\n+ constexpr std::same_as<std::size_t> auto w = P::word_size;\n+ static_assert( w == 32 );\n+ constexpr std::same_as<std::size_t> auto n = P::word_count;\n+ static_assert( n == 4 );\n+ constexpr std::same_as<std::size_t> auto r = P::round_count;\n+ static_assert( r == 5 );\n+ constexpr std::array<std::uint32_t, 2> muls = P::multipliers;\n+ static_assert( muls[0] == 9 && muls[1] == 999 );\n+ constexpr std::array<std::uint32_t, 2> consts = P::round_consts;\n+ static_assert( consts[0] == 99 && consts[1] == 9999 );\n+ constexpr std::same_as<std::uint32_t> auto def = P::default_seed;\n+ static_assert( def == 20111115u );\n }\n \n-int\n-main()\n+namespace test2\n {\n- test01();\n- return 0;\n+ using P = std::philox_engine<std::uint64_t, 64, 2, 12, 77, 777>;\n+ constexpr std::same_as<std::uint64_t> auto min = P::min();\n+ static_assert( min == 0 );\n+ constexpr std::same_as<std::uint64_t> auto max = P::max();\n+ static_assert( max == 0xffffffffffffffff );\n+ constexpr std::same_as<std::size_t> auto w = P::word_size;\n+ static_assert( w == 64 );\n+ constexpr std::same_as<std::size_t> auto n = P::word_count;\n+ static_assert( n == 2 );\n+ constexpr std::same_as<std::size_t> auto r = P::round_count;\n+ static_assert( r == 12 );\n+ constexpr std::array<std::uint64_t, 1> muls = P::multipliers;\n+ static_assert( muls[0] == 77 );\n+ constexpr std::array<std::uint64_t, 1> consts = P::round_consts;\n+ static_assert( consts[0] == 777 );\n+ constexpr std::same_as<std::uint64_t> auto def = P::default_seed;\n+ static_assert( def == 20111115u );\n }\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constexpr_data.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constexpr_data.cc\ndeleted file mode 100644\nindex 5be0108c88cd..000000000000\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constexpr_data.cc\n+++ /dev/null\n@@ -1,50 +0,0 @@\n-// { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n-\n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n-\n-#include <random>\n-#include <testsuite_common_types.h>\n-\n-namespace __gnu_test\n-{\n- struct constexpr_member_data\n- {\n- template<typename _Ttesttype>\n- void\n- operator()()\n- {\n-\tstruct _Concept\n-\t{\n-\t void __constraint()\n-\t {\n-\t constexpr auto v1 __attribute__((unused))\n-\t\t= _Ttesttype::word_size;\n-\t constexpr auto v2 __attribute__((unused))\n-\t\t= _Ttesttype::word_count;\n-\t constexpr auto v3 __attribute__((unused))\n-\t\t= _Ttesttype::round_count;\n-\t constexpr auto v4 __attribute__((unused))\n-\t\t= _Ttesttype::multipliers;\n-\t constexpr auto v5 __attribute__((unused))\n-\t\t= _Ttesttype::round_consts;\n-\t constexpr auto v6 __attribute__((unused))\n-\t\t= _Ttesttype::default_seed;\n-\t }\n-\t};\n-\n-\t_Concept c;\n-\tc.__constraint();\n- }\n- };\n-};\n-\n-int\n-main()\n-{\n- __gnu_test::constexpr_member_data test;\n- typedef std::philox4x32 type;\n- test.operator()<type>();\n- return 0;\n-}\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constexpr_functions.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constexpr_functions.cc\ndeleted file mode 100644\nindex eb61d15568aa..000000000000\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/constexpr_functions.cc\n+++ /dev/null\n@@ -1,41 +0,0 @@\n-// { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n-\n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n-\n-#include <random>\n-#include <testsuite_common_types.h>\n-\n-namespace __gnu_test\n-{\n- struct constexpr_member_functions\n- {\n- template<typename _Ttesttype>\n- void\n- operator()()\n- {\n-\tstruct _Concept\n-\t{\n-\t void __constraint()\n-\t {\n-\t constexpr auto v1 __attribute__((unused))\n-\t\t= _Ttesttype::min();\n-\t constexpr auto v2 __attribute__((unused))\n-\t\t= _Ttesttype::max();\n-\t }\n-\t};\n-\t_Concept c;\n-\tc.__constraint();\n- }\n- };\n-}\n-\n-int\n-main()\n-{\n- __gnu_test::constexpr_member_functions test;\n- typedef std::philox4x32 type;\n- test.operator()<type>();\n- return 0;\n-}\ndiff --git a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/typedefs.cc b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/typedefs.cc\nindex b368ee741069..1fc8fedc4c69 100644\n--- a/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/typedefs.cc\n+++ b/libstdc++-v3/testsuite/26_numerics/random/philox_engine/requirements/typedefs.cc\n@@ -1,9 +1,7 @@\n-// { dg-do run { target c++26 } }\n-// { dg-require-cstdint \"\" }\n-\n-// 29.5.4 Random Number Engine Class Templates\n-// 29.5.4.5 Class Template philox_engine\n+// { dg-do compile { target c++26 } }\n+// { dg-require-cpp-feature-test __cpp_lib_philox_engine }\n \n+// N5014 29.5.4.5 Class Template philox_engine\n \n #include <random>\n \n@@ -16,11 +14,17 @@ test01()\n \t\t 0xBB67AE85> testType;\n \n typedef testType::result_type result_type;\n+ static_assert( std::is_same_v<result_type, std::uint_fast32_t> );\n }\n \n-int\n-main()\n+void\n+test02()\n {\n- test01();\n- return 0;\n+ typedef std::philox_engine<std::uint_fast64_t,\n+\t\t 64, 4, 10, 0xCA5A826395121157,\n+\t\t 0x9E3779B97F4A7C15, 0xD2E7470EE14C6C93,\n+\t\t 0xBB67AE8584CAA73B> testType;\n+\n+ typedef testType::result_type result_type;\n+ static_assert( std::is_same_v<result_type, std::uint_fast64_t> );\n }\n", "prefixes": [ "v1", "2/2" ] }