[Mesa-dev] [PATCH] util: fix warning/error on 32bit build

Tapani Pälli tapani.palli at intel.com
Tue Jul 25 06:33:07 UTC 2017


On 07/25/2017 09:08 AM, Michel Dänzer wrote:
> On 25/07/17 03:02 PM, Michel Dänzer wrote:
>> On 25/07/17 02:42 PM, Tapani Pälli wrote:
>>> Add uintptr_t cast to fix 'cast to pointer from integer of different size'
>>> warning on 32bit build (build error on Android M).
>>>
>>> Signed-off-by: Tapani Pälli <tapani.palli at intel.com>
>>> ---
>>>   src/util/hash_table.c | 4 ++--
>>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>>
>>> diff --git a/src/util/hash_table.c b/src/util/hash_table.c
>>> index a9d442d..1bda214 100644
>>> --- a/src/util/hash_table.c
>>> +++ b/src/util/hash_table.c
>>> @@ -588,7 +588,7 @@ _mesa_hash_table_u64_insert(struct hash_table_u64 *ht, uint64_t key,
>>>      }
>>>   
>>>      if (sizeof(void *) == 8) {
>>> -      _mesa_hash_table_insert(ht->table, (void *)key, data);
>>> +      _mesa_hash_table_insert(ht->table, (void *)(uintptr_t)key, data);
>>>      } else {
>>>         struct hash_key_u64 *_key = CALLOC_STRUCT(hash_key_u64);
>>>   
>>> @@ -604,7 +604,7 @@ static struct hash_entry *
>>>   hash_table_u64_search(struct hash_table_u64 *ht, uint64_t key)
>>>   {
>>>      if (sizeof(void *) == 8) {
>>> -      return _mesa_hash_table_search(ht->table, (void *)key);
>>> +      return _mesa_hash_table_search(ht->table, (void *)(uintptr_t)key);
>>>      } else {
>>>         struct hash_key_u64 _key = { .value = key };
>>>         return _mesa_hash_table_search(ht->table, &_key);
>>>
>> This means that the upper 32 bits of the key are ignored on 32-bit
>> platforms, right? Is that okay?
> Never mind, I missed that the changed code is guarded by if (sizeof(void
> *) == 8).
>
> Reviewed-by: Michel Dänzer <michel.daenzer at amd.com>

Yep, it's the 64bit path, thanks for review!


// Tapani



More information about the mesa-dev mailing list