[vlc-devel] [PATCH] compat: ffsll use long long int as argument

Rémi Denis-Courmont remi at remlab.net
Fri Dec 23 18:27:12 CET 2016


Le keskiviikkona 21. joulukuuta 2016, 17.42.58 EET Jean-Baptiste Kempf a 
écrit :
> ---
>  compat/ffsll.c       | 4 ++--
>  include/vlc_fixups.h | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/compat/ffsll.c b/compat/ffsll.c
> index f35134af0d..428eaccd76 100644
> --- a/compat/ffsll.c
> +++ b/compat/ffsll.c
> @@ -1,5 +1,5 @@
>  /**************************************************************************
> *** - * ffsllp.c: GNU ffsll() replacement
> + * ffsll.c: GNU ffsll() replacement
>  
> ***************************************************************************
> ** * Copyright © 2015 Rémi Denis-Courmont
>   *
> @@ -24,7 +24,7 @@
> 
>  #include <limits.h>
> 
> -int ffsll(unsigned long long x)
> +int ffsll(long long x)
>  {
>      for (unsigned i = 0; i < sizeof (x) * CHAR_BIT; i++)
>          if ((x >> i) & 1)

I believe it should work, but did you check that this returns the correct 
result with (INT64_C(1) << 63) input?

> diff --git a/include/vlc_fixups.h b/include/vlc_fixups.h
> index 3b80f9d33c..30fc0bd444 100644
> --- a/include/vlc_fixups.h
> +++ b/include/vlc_fixups.h
> @@ -144,7 +144,7 @@ int vasprintf (char **, const char *, va_list);
> 
>  /* string.h */
>  #ifndef HAVE_FFSLL
> -int ffsll(unsigned long long);
> +int ffsll(long long);
>  #endif
> 
>  #ifndef HAVE_MEMRCHR


-- 
雷米‧德尼-库尔蒙
https://www.remlab.net/



More information about the vlc-devel mailing list