VirtualBox

Changeset 7816 in vbox


Ignore:
Timestamp:
Apr 9, 2008 7:30:56 AM (17 years ago)
Author:
vboxsync
Message:

fixed annoying gcc warnings about dereferencing type-punned pointers

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/stam.h

    r6796 r7816  
    5353 */
    5454#ifdef __GNUC__
    55 # define STAM_GET_TS(u64)    \
    56     __asm__ __volatile__ ("rdtsc\n\t" : "=a" ( ((uint32_t *)&(u64))[0] ), "=d" ( ((uint32_t *)&(u64))[1]))
     55# if defined(RT_ARCH_X86)
     56   /* This produces optimal assembler code for x86 but does not work for AMD64 ('A' means 'either rax or rdx') */
     57#  define STAM_GET_TS(u64) __asm__ __volatile__ ("rdtsc\n\t" : "=A" (u64));
     58# elif defined(RT_ARCH_AMD64)
     59#  define STAM_GET_TS(u64) \
     60    do { uint64_t low, high; \
     61         __asm__ __volatile__ ("rdtsc\n\t" : "=a"(low), "=d"(high)); \
     62         (u64) = ((high << 32) | low); \
     63    } while (0)
     64# endif
    5765#elif _MSC_VER >= 1400
    5866# pragma intrinsic(__rdtsc)
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette