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: unassig...@gcc.gnu.org

        ReportedBy: y...@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 via email to