From patchwork Mon Jun 25 15:58:45 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ed Smith-Rowland <3dw4rd@verizon.net> X-Patchwork-Id: 167153 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 863E7B6FAA for ; Tue, 26 Jun 2012 01:59:48 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1341244789; h=Comment: DomainKey-Signature:Received:Received:Received:Received: Message-id:Date:From:User-Agent:MIME-version:To:Cc:Subject: References:In-reply-to:Content-type:Mailing-List:Precedence: List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=JzhqA6so95I/jzmtBiIdIIpOXxY=; b=oYj8R2Qn4SNVTpI q5cNo1Z+uI6FbpkPXzYIX71RNt9Y7NfkaCkfXlEBeU0Lkyg9cwrG50r/razU9iuh 2rGN+FLOLb89/Far5WsoTZvKFlgrIpsBf14SRiC5Xjhq4dm0LoUABNVbAYmus5SL +xe15+PzXPGKO7FT5ZNlZ8ay3uKo= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Message-id:Date:From:User-Agent:MIME-version:To:Cc:Subject:References:In-reply-to:Content-type:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WkkW5CJfZxmQxJ2rXIVRsqPlnkTUCjDWqqUW+dx4odNil6rtA5LsJyhta6fU5/ t0edWyAwU+83DNA/JotSikRu+p+U4sH65+GuLkVopeTND+fNMCC9rCk60fgfJKLJ EGzmkP7AkH3D6sLL0sYzn55mYct3WBS28QhE2sTDd1/2M=; Received: (qmail 26991 invoked by alias); 25 Jun 2012 15:59:19 -0000 Received: (qmail 26884 invoked by uid 22791); 25 Jun 2012 15:59:16 -0000 X-SWARE-Spam-Status: No, hits=0.9 required=5.0 tests=AWL, BAYES_00, BOTNET, KHOP_RCVD_UNTRUST, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_W, RCVD_IN_HOSTKARMA_WL, RCVD_IN_HOSTKARMA_YE, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from vms173005pub.verizon.net (HELO vms173005pub.verizon.net) (206.46.173.5) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 25 Jun 2012 15:59:02 +0000 Received: from [192.168.1.8] ([unknown] [108.3.147.51]) by vms173005.mailsrvcs.net (Sun Java(tm) System Messaging Server 7u2-7.02 32bit (built Apr 16 2009)) with ESMTPA id <0M6600FYXKDXANA0@vms173005.mailsrvcs.net>; Mon, 25 Jun 2012 10:58:46 -0500 (CDT) Message-id: <4FE88AB5.9080507@verizon.net> Date: Mon, 25 Jun 2012 11:58:45 -0400 From: Ed Smith-Rowland <3dw4rd@verizon.net> User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1 MIME-version: 1.0 To: Jonathan Wakely Cc: "libstdc++@gcc.gnu.org" , gcc-patches Subject: Re: Add noexcept and constexpr to tr2/dynamic_bitset. References: <4FE690E2.8040001@verizon.net> In-reply-to: Content-type: multipart/mixed; boundary=------------060104080505010303080502 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On 06/24/2012 07:18 AM, Jonathan Wakely wrote: > On 24 June 2012 12:18, Jonathan Wakely wrote: >> On 24 June 2012 05:00, Ed Smith-Rowland wrote: >>> Subject says it. >>> >> This looks good, please CC gcc-patches with a changelog entry and >> confirmation it was tested and it can go in. Thanks. > And don't forget to update the copyright year. > Built and tested on x86_64-linux-gnu. 2012-06-25 Edward Smith-Rowland <3dw4rd@verizon.net> * include/tr2/dynamic_bitset (count, size, num_blocks, empty, max_size): Add noexcept. Index: include/tr2/dynamic_bitset =================================================================== --- include/tr2/dynamic_bitset (revision 188848) +++ include/tr2/dynamic_bitset (working copy) @@ -1,6 +1,6 @@ // TR2 -*- C++ -*- -// Copyright (C) 2009, 2010, 2011 Free Software Foundation, Inc. +// Copyright (C) 2009, 2010, 2011, 2012 Free Software Foundation, Inc. // // This file is part of the GNU ISO C++ Library. This library is free // software; you can redistribute it and/or modify it under the @@ -146,19 +146,19 @@ { return this->_M_w.get_allocator(); } static size_type - _S_whichword(size_type __pos) + _S_whichword(size_type __pos) noexcept { return __pos / _S_bits_per_block; } static size_type - _S_whichbyte(size_type __pos) + _S_whichbyte(size_type __pos) noexcept { return (__pos % _S_bits_per_block) / __CHAR_BIT__; } static size_type - _S_whichbit(size_type __pos) + _S_whichbit(size_type __pos) noexcept { return __pos % _S_bits_per_block; } static block_type - _S_maskbit(size_type __pos) + _S_maskbit(size_type __pos) noexcept { return (static_cast(1)) << _S_whichbit(__pos); } block_type& @@ -333,7 +333,7 @@ } size_type - _M_size() const + _M_size() const noexcept { return this->_M_w.size(); } unsigned long @@ -1141,28 +1141,29 @@ /// Returns the number of bits which are set. size_type - count() const + count() const noexcept { return this->_M_do_count(); } /// Returns the total number of bits. size_type - size() const + size() const noexcept { return this->_M_Nb; } /// Returns the total number of blocks. - size_type num_blocks() const + size_type + num_blocks() const noexcept { return this->_M_size(); } /// Returns true if the dynamic_bitset is empty. bool - empty() const + empty() const noexcept { return (this->_M_Nb == 0); } /// Returns the maximum size of a dynamic_bitset object having the same /// type as *this. /// The real answer is max() * bits_per_block but is likely to overflow. - /*constexpr*/ size_type - max_size() const + constexpr size_type + max_size() noexcept { return std::numeric_limits::max(); } /**