[vlc-devel] [PATCH 17/22] vlc_arrays: DictHash output is always used as an int

Steve Lhomme robux4 at videolabs.io
Fri Jul 31 17:09:33 CEST 2015


On Fri, Jul 31, 2015 at 5:03 PM, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le 2015-07-31 17:55, Steve Lhomme a écrit :
>>
>> ---
>>  include/vlc_arrays.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/include/vlc_arrays.h b/include/vlc_arrays.h
>> index 91f5405..d5802ee 100644
>> --- a/include/vlc_arrays.h
>> +++ b/include/vlc_arrays.h
>> @@ -375,7 +375,7 @@ vlc_array_remove( vlc_array_t * p_array, int i_index )
>>   * fast and not suck too much. This one is pretty fast and did 0
>> collisions
>>   * in wenglish's dictionary.
>>   */
>> -static inline uint64_t DictHash( const char *psz_string, int hashsize )
>> +static inline int DictHash( const char *psz_string, int hashsize )
>>  {
>>      uint64_t i_hash = 0;
>>      if( psz_string )
>> @@ -387,7 +387,7 @@ static inline uint64_t DictHash( const char
>> *psz_string, int hashsize )
>>              i_hash ^= i_hash >> 8;
>>          }
>>      }
>> -    return i_hash % hashsize;
>> +    return (int) (i_hash % hashsize);
>
>
> This makes no sense.

The variable is a uint64_t, the function returns an int. Some
compilers will tell you the implied cast may be wrong, we just say
it's correct.

>>  }
>>
>>  typedef struct vlc_dictionary_entry_t
>
>
> --
> Rémi Denis-Courmont
> http://www.remlab.net/
> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list