[PATCH 8/8] score: Use builtin for _Bitfield_Find_first_bit()

Gedare Bloom gedare at rtems.org
Wed Jun 8 14:37:43 UTC 2016


looks good

On Wed, Jun 8, 2016 at 9:58 AM, Sebastian Huber
<sebastian.huber at embedded-brains.de> wrote:
> In case the CPU architecture provides no specialized
> _CPU_Bitfield_Find_first_bit() macro, then use the __builtin_clz()
> builtin in case __GNUC__ is defined.
> ---
>  cpukit/score/include/rtems/score/prioritybitmapimpl.h | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/cpukit/score/include/rtems/score/prioritybitmapimpl.h b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
> index 2041a20..0082720 100644
> --- a/cpukit/score/include/rtems/score/prioritybitmapimpl.h
> +++ b/cpukit/score/include/rtems/score/prioritybitmapimpl.h
> @@ -60,6 +60,8 @@ RTEMS_INLINE_ROUTINE unsigned int _Bitfield_Find_first_bit(
>
>  #if ( CPU_USE_GENERIC_BITFIELD_CODE == FALSE )
>    _CPU_Bitfield_Find_first_bit( value, bit_number );
> +#elif defined(__GNUC__)
> +  bit_number = __builtin_clz( value ) - __SIZEOF_INT__ * __CHAR_BIT__ + 16;
>  #else
>    if ( value < 0x100 ) {
>      bit_number = _Bitfield_Leading_zeros[ value ] + 8;
> --
> 1.8.4.5
>
> _______________________________________________
> devel mailing list
> devel at rtems.org
> http://lists.rtems.org/mailman/listinfo/devel



More information about the devel mailing list