uint64 on raspberry pi 2

  • Hi,

    I am trying to use uint64_t on RPI2 but I don't understand what is happening (unlike int64_t which seems ok).


    uint64_t t1, t2, t3;
    t1 = pkthdr->ts.tv_sec % 86400;
    t2 = (uint64_t)t1*(uint64_t)1000000;
    t3 = ( int64_t)t1*( int64_t)1000000;
    print("%llu, %llu, %llu - ", t1, t2, t3);
    print("%d, %d - ", sizeof(uint64_t), sizeof(int64_t));


    84642, 18446744072452205696, 84642000000 - 8, 8 -
    84643, 18446744072453205696, 84643000000 - 8, 8 -

    Sizeof(uint64_t) is 8 => ok,
    multiply with int64_t is ok,
    where 18446744072453205696 come from ? Does it compute on 32 bits instead of 64 ? Is there a work around ?

    Thank you for your help

  • I make some tests:
    The values are computed on int32 instead of uint64.
    I have the same problem on RPI2 and on ubuntu.
    If I return the values to another function, the values are computed correctly. I hope the problem won't come back.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.