public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "yann at droneaud dot fr" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug other/55899] New: GCC should provide built-ins in <stdint.h> data types flavor/version/variation
Date: Mon, 07 Jan 2013 15:15:00 -0000	[thread overview]
Message-ID: <bug-55899-4@http.gcc.gnu.org/bugzilla/> (raw)


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55899

             Bug #: 55899
           Summary: GCC should provide built-ins in <stdint.h> data types
                    flavor/version/variation
    Classification: Unclassified
           Product: gcc
           Version: unknown
            Status: UNCONFIRMED
          Severity: enhancement
          Priority: P3
         Component: other
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: yann@droneaud.fr


Built-in functions such as 
 __builtin_clz(unsigned int x)
 __builtin_ctz(unsigned int x)
 __builtin_ffs(unsigned int x)
 etc.
are lacking variant based on C99 <stdint.h> data type.

Currently there's
 __builtin_clzl(unsigned long x)
 __builtin_clzll(unsigned long long x)

I'd like to have:
 __builtin_clz32(uint32_t x)
 __builtin_clz64(uint64_t x)

This would help to hard code the number of bits when using such construct to
know the number of bit needed to hold a value:

(8 * sizeof(unsigned int)) - __builtin_clz(value)

when value is of type uint32_t:

 32 - __builtin_clz32(value)

Note: there's already __builtin_bswap32(int32_t x) and
__builtin_bswap64(int64_t x)


             reply	other threads:[~2013-01-07 15:15 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-07 15:15 yann at droneaud dot fr [this message]
2013-01-10 17:30 ` [Bug other/55899] " hp at gcc dot gnu.org
2022-11-29 11:45 ` yann at droneaud dot fr
2022-11-29 18:59 ` joseph at codesourcery dot com

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=bug-55899-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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).