Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Special Interest Groups
  3. QtonPi
  4. uint64 on raspberry pi 2
Forum Updated to NodeBB v4.3 + New Features

uint64 on raspberry pi 2

Scheduled Pinned Locked Moved Solved QtonPi
2 Posts 1 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    boilley
    wrote on 1 Dec 2015, 23:40 last edited by
    #1

    Hi,

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

    Program:

    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));
    

    Output:

    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
    Etienne

    1 Reply Last reply
    0
    • B Offline
      B Offline
      boilley
      wrote on 3 Dec 2015, 08:06 last edited by
      #2

      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.

      1 Reply Last reply
      0

      1/2

      1 Dec 2015, 23:40

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved