From patchwork Sat Jul 8 11:13:08 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ken Matsui X-Patchwork-Id: 117432 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:9f45:0:b0:3ea:f831:8777 with SMTP id v5csp3853957vqx; Sat, 8 Jul 2023 04:15:36 -0700 (PDT) X-Google-Smtp-Source: APBJJlFL9okhgaZ1Srkrw8OL1wWGt8MmEK2wbrNdbtQFFLlAag8kIPH448dZaQVKi974Jw9+OHhb X-Received: by 2002:a17:906:6485:b0:98e:419b:4cbc with SMTP id e5-20020a170906648500b0098e419b4cbcmr6197076ejm.12.1688814935803; Sat, 08 Jul 2023 04:15:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1688814935; cv=none; d=google.com; s=arc-20160816; b=zCin8c2aJTBxgrYcrO7tKD4BXCNkTOmE79eZZMkD28JctVS/+e6dMO0rRye9xQby90 sMIc9ClPn6boBhiYqBvy2reEUMOU3YUGPHZjUNpHlWvS2Aiy7iEFFeHYohkDGaEpLxKT 8fCJ+vjmLj/D/2QTv2wGt6oLxQLLzC4y7lv1vtmLBFUbui9hRnTIm5JsYa3shd6So8l7 4/xTZV/oZhMGxVWQNRJKMBB+i4UIiqwCi+udo/bS8QQ9xZN+aZ5nD3m5IrSz9nRu5QkL wJ8QJyL1a9rBIY9Lr0j/N9rihJNRpD1ZnAA3Cns+MdJa9L5qT0ZkpU+8Jq1UmMnHbxsF Lvmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:dmarc-filter:delivered-to :dkim-signature:dkim-filter; bh=tXDPTGdFMPxXKs3so3XpfSVSnTWX6wo2crOM77BPLSY=; fh=1CAabwJrK+ugngH18pg8mqZVlwzSJe6ffxxXK5OO7Vs=; b=jrOVbDumhdV8zZVLbwDnaFHcNlaiGCbn0hyF7mTnSiPMBmnVHjlU71N6fbNfsG9p5Y 2YZGValDIUuOwmTUa3M0E3SJImkQv7m3j5ug/WHN9LVzSkesl081PxUak3FUcvBMOY3H bWpAzOyKyCWGD1BmMcRt59cAdiP/FJn4EHG/xCqG/Pd+wRvqS2DEbP6//+VIA4SgO7Hq zWFX+vdYMS3xUqMMRUqfUuWN29S/FV6q8Kuwo4oN+4XrzblIMZhfT6MON8YdmaXvMYse MZJ/S4JimoJ0Uz85E3AduEedwmIJGFE7NrtKteruEVHbi+dzB6cAJvnXdx1iSTLk1pQG BkXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=mlGu1uY+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id ba17-20020a0564021ad100b0051a59d81c45si3210064edb.18.2023.07.08.04.15.35 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 08 Jul 2023 04:15:35 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=mlGu1uY+; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 93B9D3852653 for ; Sat, 8 Jul 2023 11:14:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 93B9D3852653 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1688814893; bh=tXDPTGdFMPxXKs3so3XpfSVSnTWX6wo2crOM77BPLSY=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=mlGu1uY+JScJ3rfvz8JueaWFyWj0bYyJiGDK8gRBI+mgZtwu7FC2dDtxyQ7CFoovp Iui+BJeM4EL1TS5dFpYI/0vb4mHkWM53Y1iFLsPrpAljgG3jn8n3bgf9mmxIAzouDM xSbi/wYp2mTLJ0pJOM5y6/jo0Gn4O8ViKyh1Mxcg= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mx0a-00641c01.pphosted.com (mx0a-00641c01.pphosted.com [205.220.165.146]) by sourceware.org (Postfix) with ESMTPS id A6F343857731; Sat, 8 Jul 2023 11:14:09 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A6F343857731 Received: from pps.filterd (m0247473.ppops.net [127.0.0.1]) by mx0a-00641c01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 368B7VK8004442; Sat, 8 Jul 2023 11:14:08 GMT Received: from mxout21.s.uw.edu (mxout21.s.uw.edu [140.142.32.139]) by mx0a-00641c01.pphosted.com (PPS) with ESMTPS id 3rpyu3h0b9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Sat, 08 Jul 2023 11:14:08 +0000 Received: from smtp.washington.edu (smtp.washington.edu [128.208.60.132]) by mxout21.s.uw.edu (8.14.4+UW20.07/8.14.4+UW22.04) with ESMTP id 368BDpiF015316 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Sat, 8 Jul 2023 04:13:51 -0700 X-Auth-Received: from localhost.localdomain ([10.154.74.234]) (authenticated authid=kmatsui) by smtp.washington.edu (8.16.1+UW21.10/8.14.4+UW19.10) with ESMTPSA id 368BDAVk028298 (version=TLSv1.2 cipher=DHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 8 Jul 2023 04:13:51 -0700 X-UW-Orig-Sender: kmatsui@smtp.washington.edu To: gcc-patches@gcc.gnu.org Cc: libstdc++@gcc.gnu.org, Ken Matsui Subject: [PATCH v4 2/2] libstdc++: use new built-in trait __is_unsigned Date: Sat, 8 Jul 2023 04:13:08 -0700 Message-ID: <20230708111308.92402-2-kmatsui@gcc.gnu.org> X-Mailer: git-send-email 2.41.0 In-Reply-To: <20230708111308.92402-1-kmatsui@gcc.gnu.org> References: <20230708055435.68714-1-kmatsui@gcc.gnu.org> <20230708111308.92402-1-kmatsui@gcc.gnu.org> MIME-Version: 1.0 X-Proofpoint-GUID: oUi3FVdkgTHLwZ3MEQwdWnXNTVhN7BYJ X-Proofpoint-ORIG-GUID: oUi3FVdkgTHLwZ3MEQwdWnXNTVhN7BYJ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-08_06,2023-07-06_02,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 clxscore=1034 priorityscore=1501 spamscore=0 mlxscore=0 lowpriorityscore=0 suspectscore=0 mlxlogscore=890 malwarescore=0 adultscore=0 impostorscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2305260000 definitions=main-2307080102 X-Spam-Status: No, score=-13.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NEUTRAL, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ken Matsui via Gcc-patches From: Ken Matsui Reply-To: Ken Matsui Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1770850810037301032?= X-GMAIL-MSGID: =?utf-8?q?1770850810037301032?= This patch lets libstdc++ use new built-in trait __is_unsigned. libstdc++-v3/ChangeLog: * include/std/type_traits (is_unsigned): Use __is_unsigned built-in trait. (is_unsigned_v): Likewise. Signed-off-by: Ken Matsui --- libstdc++-v3/include/std/type_traits | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/libstdc++-v3/include/std/type_traits b/libstdc++-v3/include/std/type_traits index 0e7a9c9c7f3..7eeb0da7a27 100644 --- a/libstdc++-v3/include/std/type_traits +++ b/libstdc++-v3/include/std/type_traits @@ -884,10 +884,17 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { }; /// is_unsigned +#if __has_builtin(__is_unsigned) + template + struct is_unsigned + : public __bool_constant<__is_unsigned(_Tp)> + { }; +#else template struct is_unsigned : public __and_, __not_>>::type { }; +#endif /// @cond undocumented template @@ -3242,8 +3249,14 @@ template template inline constexpr bool is_signed_v = is_signed<_Tp>::value; + +#if __has_builtin(__is_unsigned) +template + inline constexpr bool is_unsigned_v = __is_unsigned(_Tp); +#else template inline constexpr bool is_unsigned_v = is_unsigned<_Tp>::value; +#endif template inline constexpr bool is_constructible_v = __is_constructible(_Tp, _Args...);