On Wed, Apr 27, 2016 at 1:57 PM, Maxim Uvarov <[email protected]>
wrote:

> On 04/27/16 21:36, Bill Fischofer wrote:
>
>> Add an additional cast to avoid compile errors in 32-bit mode
>>
>> Signed-off-by: Bill Fischofer <[email protected]>
>> ---
>>   test/validation/packet/packet.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/test/validation/packet/packet.c
>> b/test/validation/packet/packet.c
>> index 4bae4d8..654fe0e 100644
>> --- a/test/validation/packet/packet.c
>> +++ b/test/validation/packet/packet.c
>> @@ -1172,7 +1172,7 @@ void packet_test_align(void)
>>         pkt_data = odp_packet_offset(pkt, 0, &seg_len, NULL);
>>         offset = seg_len - 5;
>>         pkt_data = odp_packet_offset(pkt, offset, &seg_len, NULL);
>> -       if ((uint64_t)pkt_data % max_align == 0) {
>> +       if ((uint64_t)(uintptr_t)pkt_data % max_align == 0) {
>>
> Does only one cast to uintptr_t  work here?
>

uintptr_t has type pointer to unsigned integer.  Since that has an implied
size, I'm not sure if the arithmetic would scale things according to C type
rules. I'm just trying to check the value of the address, so treating the
whole thing as a uint64_t seems safest.


>
> Maxim.
>
>                 offset--;
>>                 pkt_data = odp_packet_offset(pkt, offset, &seg_len, NULL);
>>         }
>> @@ -1184,7 +1184,7 @@ void packet_test_align(void)
>>         CU_ASSERT(odp_packet_len(pkt) == pkt_len);
>>         _packet_compare_offset(pkt, offset, segmented_test_packet, offset,
>>                                aligned_seglen);
>> -       CU_ASSERT((uint64_t)aligned_data % max_align == 0);
>> +       CU_ASSERT((uint64_t)(uintptr_t)aligned_data % max_align == 0);
>>         odp_packet_free(pkt);
>>   }
>>
>
> _______________________________________________
> lng-odp mailing list
> [email protected]
> https://lists.linaro.org/mailman/listinfo/lng-odp
>
_______________________________________________
lng-odp mailing list
[email protected]
https://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to