Instruction RDTSC works the same in long mode (64-bit) as it does in IA32
mode: the upper dword is in EDX and the lower dword is in EAX. Currently,
hwtime.h assumes that RAX contains the 64-bit value. However logical the
assumption, it is still incorrect.

Correct code:

#elif (defined(__GNUC__) && defined(__x86_64__))

  __inline__ sqlite_uint64 sqlite3Hwtime(void){
     unsigned int lo, hi;
     __asm__ __volatile__ ("rdtsc" : "=a" (lo), "=d" (hi));
     return (sqlite_uint64)hi << 32 | lo;
  }

#elif (defined(__GNUC__) && defined(__ppc__))
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to