From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 2908 invoked by alias); 17 May 2017 05:22:33 -0000 Mailing-List: contact newlib-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: newlib-owner@sourceware.org Received: (qmail 2112 invoked by uid 89); 17 May 2017 05:22:32 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-12.0 required=5.0 tests=AWL,BAYES_50,FOREIGN_BODY,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,RCVD_IN_DNSWL_NONE,SPF_PASS,T_FILL_THIS_FORM_SHORT autolearn=ham version=3.3.2 spammy=keine, diese, mitteilung, H*r:192.168.96 X-HELO: dedi548.your-server.de Received: from dedi548.your-server.de (HELO dedi548.your-server.de) (85.10.215.148) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 17 May 2017 05:22:31 +0000 Received: from [88.198.220.130] (helo=sslproxy01.your-server.de) by dedi548.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.85_2) (envelope-from ) id 1dArPs-0007FI-4r; Wed, 17 May 2017 07:22:32 +0200 Received: from [82.135.62.35] (helo=mail.embedded-brains.de) by sslproxy01.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.84_2) (envelope-from ) id 1dArPr-0001PW-Th; Wed, 17 May 2017 07:22:32 +0200 Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id ED42A2A003F; Wed, 17 May 2017 07:23:05 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id pIBaNy494MXO; Wed, 17 May 2017 07:23:05 +0200 (CEST) Received: from localhost (localhost.localhost [127.0.0.1]) by mail.embedded-brains.de (Postfix) with ESMTP id 712492A0047; Wed, 17 May 2017 07:23:05 +0200 (CEST) Received: from mail.embedded-brains.de ([127.0.0.1]) by localhost (zimbra.eb.localhost [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id Jnj6FkRUwpDn; Wed, 17 May 2017 07:23:05 +0200 (CEST) Received: from [192.168.96.129] (unknown [192.168.96.129]) by mail.embedded-brains.de (Postfix) with ESMTPSA id 525C82A003F; Wed, 17 May 2017 07:23:05 +0200 (CEST) Subject: Re: [PATCH] For RTEMS-LIBBSD support, add bitcount routines To: Craig Howland , newlib@sourceware.org References: <201705161823.v4GIMc16015657@mx0a-00116901.pphosted.com> From: Sebastian Huber Message-ID: <591BDE16.6000501@embedded-brains.de> Date: Wed, 17 May 2017 05:22:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2017/txt/msg00331.txt.bz2 On 16/05/17 21:04, Craig Howland wrote: > On 05/16/2017 02:23 PM, Kevin Kirspel wrote: >> --- >> newlib/libc/include/sys/types.h | 66=20 >> ++++++++++++++++++++++++++++++++++++++--- >> 1 file changed, 62 insertions(+), 4 deletions(-) >> >> diff --git a/newlib/libc/include/sys/types.h=20 >> b/newlib/libc/include/sys/types.h >> index 65ff520..83f891e 100644 >> ... >> +#ifdef __LP64__ >> +static __inline __uint64_t >> +__bitcount64(__uint64_t _x) >> +{ >> ... >> +} >> + >> +#define __bitcountl(x) __bitcount64((unsigned long)(x)) >> +#else /* __LP64__ */ >> +static __inline __uint64_t >> +__bitcount64(__uint64_t _x) >> +{ >> + return (__bitcount32(_x >> 32) + __bitcount32(_x)); >> +} >> + >> +#define __bitcountl(x) __bitcount32((unsigned long)(x)) >> +#endif /* __LP64__ */ >> +#define __bitcount(x) __bitcount32((unsigned int)(x)) >> +#endif /* __POPCNT__ */ >> + > Depending only upon LP64 is not sufficient in general to get all the=20 > sizes right. (ARM Cortex A53, for example, has 64-bit int,=20 > too--ILP64. So A53 would probably end up with two problems, bitcountl=20 > and bitcount.)=20 RTEMS doesn't support an __ILP64__ ABI at the moment, so it should be=20 sufficient. However, maybe we should use the __SIZEOF_INT__ and=20 __SIZEOF_LONG__ builtin defines instead of __LP64. --=20 Sebastian Huber, embedded brains GmbH Address : Dornierstr. 4, D-82178 Puchheim, Germany Phone : +49 89 189 47 41-16 Fax : +49 89 189 47 41-09 E-Mail : sebastian.huber@embedded-brains.de PGP : Public key available on request. Diese Nachricht ist keine gesch=E4ftliche Mitteilung im Sinne des EHUG.