From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 26760 invoked by alias); 6 Mar 2011 08:57:09 -0000 Received: (qmail 26751 invoked by uid 22791); 6 Mar 2011 08:57:07 -0000 X-SWARE-Spam-Status: No, hits=-5.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,TW_CL,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mail3-relais-sop.national.inria.fr (HELO mail3-relais-sop.national.inria.fr) (192.134.164.104) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 06 Mar 2011 08:57:00 +0000 Received: from afontenayssb-151-1-46-31.w82-121.abo.wanadoo.fr (HELO laptop-mg.local) ([82.121.95.31]) by mail3-relais-sop.national.inria.fr with ESMTP/TLS/DHE-RSA-AES256-SHA; 06 Mar 2011 09:56:57 +0100 Date: Sun, 06 Mar 2011 08:57:00 -0000 From: Marc Glisse Reply-To: gcc@gcc.gnu.org To: FX cc: gcc@gcc.gnu.org Subject: Re: __builtin_clzll and uintmax_t In-Reply-To: Message-ID: References: User-Agent: Alpine 2.02 (DEB 1266 2009-07-14) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed Mailing-List: contact gcc-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-owner@gcc.gnu.org X-SW-Source: 2011-03/txt/msg00067.txt.bz2 Coucou FX, On Sat, 5 Mar 2011, FX wrote: > uintmax_t is the largest of the standard unsigned C types, so it cannot be larger than unsigned long long. That's a gcc property then. The C99 standard only guarantees that uintmax_t is at least as large as unsigned long long, but it is allowed to be some other larger type: "The following type designates an unsigned integer type capable of representing any value of any unsigned integer type: uintmax_t" > On x86_64, for example: > >> #include >> #include >> >> int main (void) >> { >> printf ("%lu ", sizeof (uintmax_t)); >> printf ("%lu ", sizeof (int)); >> printf ("%lu ", sizeof (long int)); >> printf ("%lu ", sizeof (long long int)); >> printf ("%lu\n", sizeof (__int128)); >> } > > gives : 8 4 8 8 16 I am not sure how legal that is. __int128 is an extended signed integer type, and thus the statement about intmax_t should apply to it as well. So gcc is just pretending that __int128 is not really there. >> Is __builtin_clzll available on all platforms? > > Yes, we emit calls to this built-in unconditionally in the Fortran > front-end, and it has caused no trouble. Thank you, that's the best guarantee I could ask for about the existence of __builtin_clzll. -- Marc Glisse