public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug other/55899] New: GCC should provide built-ins in <stdint.h> data types flavor/version/variation
@ 2013-01-07 15:15 yann at droneaud dot fr
  2013-01-10 17:30 ` [Bug other/55899] " hp at gcc dot gnu.org
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: yann at droneaud dot fr @ 2013-01-07 15:15 UTC (permalink / raw)
  To: gcc-bugs


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)


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-11-29 18:59 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-01-07 15:15 [Bug other/55899] New: GCC should provide built-ins in <stdint.h> data types flavor/version/variation yann at droneaud dot fr
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

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).