[vlc-devel] [PATCH 17/22] vlc_arrays: DictHash output is always used as an int
vlc at filcab.net
Sun Aug 2 21:07:49 CEST 2015
> On Aug 2, 2015, at 11:59, Rémi Denis-Courmont <remi at remlab.net> wrote:
> Le samedi 01 août 2015, 21:21:02 Francois Cartegnie a écrit :
>>>> 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.
>> Correct fix is in checking and casting hashsize.
> First, there are no bugs here. Maybe the choice of type is sub-optimal but the
> code seems perfectly fine.
> The ideal fix is to use the best suited types where possible. But we cannot
> add integer casts all over the place. Until/unless GCC and clang start showing
> the same warnings, that will simply not work. Besides, it would clutter the
> code for no reasons: I don´t think an explicit cast makes the code looks any
>> Not losing precision.
> What the heck does that even mean? Neither converting implicitly nor casting
> explicitly to int (or any other signed type) can lose precision.
How are you not losing precision? You had a 64-bit integer and are getting the bottom 32 bits.
Of course, if that’s ok for VLC’s purposes, then there’s no problem there (does using only the bottom 32 bits also have the propery: "did 0 collisions in wenglish's dictionary”?).
> Rémi Denis-Courmont
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
More information about the vlc-devel