From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22772 invoked by alias); 23 Sep 2014 19:03:22 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 22755 invoked by uid 89); 23 Sep 2014 19:03:21 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_HELO_PASS,SPF_PASS autolearn=ham version=3.3.2 X-Spam-User: qpsmtpd, 2 recipients X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Tue, 23 Sep 2014 19:03:20 +0000 Received: from int-mx14.intmail.prod.int.phx2.redhat.com (int-mx14.intmail.prod.int.phx2.redhat.com [10.5.11.27]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s8NJ3GKu018523 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 23 Sep 2014 15:03:16 -0400 Received: from localhost (ovpn-116-40.ams2.redhat.com [10.36.116.40]) by int-mx14.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s8NJ3FRo007252; Tue, 23 Sep 2014 15:03:16 -0400 Date: Tue, 23 Sep 2014 19:03:00 -0000 From: Jonathan Wakely To: DJ Delorie Cc: "Joseph S. Myers" , gcc-patches@gcc.gnu.org, libstdc++@gcc.gnu.org Subject: Re: __intN patch 3/5: main __int128 -> __intN conversion. Message-ID: <20140923190315.GQ2669@redhat.com> References: <201408132211.s7DMBGBu016387@greed.delorie.com> <201408212123.s7LLNPIQ018746@greed.delorie.com> <201408220515.s7M5Fhpa007479@greed.delorie.com> <201408221924.s7MJOcjB022631@greed.delorie.com> <201408260303.s7Q33nqm024601@greed.delorie.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Disposition: inline In-Reply-To: <201408260303.s7Q33nqm024601@greed.delorie.com> User-Agent: Mutt/1.5.23 (2014-03-12) X-SW-Source: 2014-09/txt/msg02030.txt.bz2 On 25/08/14 23:03 -0400, DJ Delorie wrote: > >> I'd like to see the updated version of the whole of patch 3 (tested >> to be actually independent of the other patches) for review, though >> I won't be reviewing the C++ parts. > >Here it is. Tested on x86_64. I include the msp430-modes.def patch >for demonstration purposes although obviously msp430's __int20 won't >work without the other patches. [snip] >* libstdc++-v3/ > * src/c++11/limits.cc: Add support for __intN types. > * include/std/type_traits: Likewise. > * include/std/limits: Likewise. > * include/c_std/cstdlib: Likewise. > * include/bits/cpp_type_traits.h: Likewise. > * include/c_global/cstdlib: Likewise. These libstdc++ changes are OK for trunk. Just one question about the include/std/limits changes below. It seems that __glibcxx_signed_b isn't strictly necessary as it doesn't use the B argument, so is it just there for consistency? >Index: libstdc++-v3/include/std/limits >=================================================================== >--- libstdc++-v3/include/std/limits (revision 214383) >+++ libstdc++-v3/include/std/limits (working copy) >@@ -122,27 +122,38 @@ > #ifndef __glibcxx_long_double_tinyness_before > # define __glibcxx_long_double_tinyness_before false > #endif > > // You should not need to define any macros below this point. > >-#define __glibcxx_signed(T) ((T)(-1) < 0) >+#define __glibcxx_signed_b(T,B) ((T)(-1) < 0) > >-#define __glibcxx_min(T) \ >- (__glibcxx_signed (T) ? -__glibcxx_max (T) - 1 : (T)0) >+#define __glibcxx_min_b(T,B) \ >+ (__glibcxx_signed_b (T,B) ? -__glibcxx_max_b (T,B) - 1 : (T)0) > >-#define __glibcxx_max(T) \ >- (__glibcxx_signed (T) ? \ >- (((((T)1 << (__glibcxx_digits (T) - 1)) - 1) << 1) + 1) : ~(T)0) >+#define __glibcxx_max_b(T,B) \ >+ (__glibcxx_signed_b (T,B) ? \ >+ (((((T)1 << (__glibcxx_digits_b (T,B) - 1)) - 1) << 1) + 1) : ~(T)0) > >-#define __glibcxx_digits(T) \ >- (sizeof(T) * __CHAR_BIT__ - __glibcxx_signed (T)) >+#define __glibcxx_digits_b(T,B) \ >+ (B - __glibcxx_signed_b (T,B)) > > // The fraction 643/2136 approximates log10(2) to 7 significant digits. >+#define __glibcxx_digits10_b(T,B) \ >+ (__glibcxx_digits_b (T,B) * 643L / 2136) >+ >+#define __glibcxx_signed(T) \ >+ __glibcxx_signed_b (T, sizeof(T) * __CHAR_BIT__)