public inbox for newlib@sourceware.org
 help / color / mirror / Atom feed
From: Sebastian Huber <sebastian.huber@embedded-brains.de>
To: Craig Howland <howland@LGSInnovations.com>, newlib@sourceware.org
Subject: Re: [PATCH] For RTEMS-LIBBSD support, add bitcount routines
Date: Wed, 17 May 2017 05:22:00 -0000	[thread overview]
Message-ID: <591BDE16.6000501@embedded-brains.de> (raw)
In-Reply-To: <e49202b4-8eec-af40-535d-8f9ca56bf4a8@LGSInnovations.com>

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 
>> ++++++++++++++++++++++++++++++++++++++---
>>   1 file changed, 62 insertions(+), 4 deletions(-)
>>
>> diff --git a/newlib/libc/include/sys/types.h 
>> 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 
> sizes right.  (ARM Cortex A53, for example, has 64-bit int, 
> too--ILP64.  So A53 would probably end up with two problems, bitcountl 
> and bitcount.) 

RTEMS doesn't support an __ILP64__ ABI at the moment, so it should be 
sufficient. However, maybe we should use the __SIZEOF_INT__ and 
__SIZEOF_LONG__ builtin defines instead of __LP64.

-- 
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äftliche Mitteilung im Sinne des EHUG.

  reply	other threads:[~2017-05-17  5:22 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-16 18:23 Kevin Kirspel
2017-05-16 19:05 ` Craig Howland
2017-05-17  5:22   ` Sebastian Huber [this message]
2017-05-17  5:11 ` Sebastian Huber

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=591BDE16.6000501@embedded-brains.de \
    --to=sebastian.huber@embedded-brains.de \
    --cc=howland@LGSInnovations.com \
    --cc=newlib@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).