From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 89221 invoked by alias); 14 Jun 2018 16:56:07 -0000 Mailing-List: contact libc-alpha-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: libc-alpha-owner@sourceware.org Received: (qmail 89209 invoked by uid 89); 14 Jun 2018 16:56:06 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,SPF_PASS autolearn=ham version=3.3.2 spammy=Hx-languages-length:608 X-HELO: zimbra.cs.ucla.edu Subject: Re: [PATCH v2 1/2] Y2038: Add 64-bit time for all architectures To: "Albert ARIBAUD (3ADEV)" , libc-alpha@sourceware.org References: <20180614135116.8767-1-albert.aribaud@3adev.fr> <20180614135116.8767-2-albert.aribaud@3adev.fr> From: Paul Eggert Openpgp: preference=signencrypt Message-ID: Date: Thu, 14 Jun 2018 16:56:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <20180614135116.8767-2-albert.aribaud@3adev.fr> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-SW-Source: 2018-06/txt/msg00418.txt.bz2 On 06/14/2018 06:51 AM, Albert ARIBAUD (3ADEV) wrote: > +/* check whether a time64_t value fits in a time_t */ > +# if __TIMESIZE == 64 > +/* __time64_t is time_t, so it always fits_in_time_t */ > +# define fits_in_time_t(x) 1 > +# else > +/* Not all __time64_t values can fit; check by type-casting */ > +static inline bool > +fits_in_time_t (__time64_t t) > +{ > + return t == (time_t) t; > +} > +# endif Don't bother with the "#if". Just have the static function unconditionally. It should generate zero instructions if time_t is 64 bits.