VirtualBox

Changeset 52454 in vbox for trunk/include/iprt


Ignore:
Timestamp:
Aug 22, 2014 7:12:23 AM (10 years ago)
Author:
vboxsync
Message:

ASMMultU32ByU32DivByU32: Cleaned up mess. Tested on x86 and amd64-msc.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm-math.h

    r52443 r52454  
    324324 * Multiple a 32-bit by a 32-bit integer and divide the result by a 32-bit integer
    325325 * using a 64 bit intermediate result.
    326  * @note    Don't use 64-bit C arithmetic here since some gcc compilers generate references to
    327  *          __udivdi3 and __umoddi3 even if this inline function is not used.
    328326 *
    329327 * @returns (u32A * u32B) / u32C.
     
    334332 * @remarks Architecture specific.
    335333 */
    336 #if RT_INLINE_ASM_EXTERNAL || !defined(__GNUC__) || (!defined(RT_ARCH_AMD64) && !defined(RT_ARCH_X86))
     334#if RT_INLINE_ASM_EXTERNAL && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
    337335DECLASM(uint32_t) ASMMultU32ByU32DivByU32(uint32_t u32A, uint32_t u32B, uint32_t u32C);
    338336#else
    339337DECLINLINE(uint32_t) ASMMultU32ByU32DivByU32(uint32_t u32A, uint32_t u32B, uint32_t u32C)
    340338{
    341 # if RT_INLINE_ASM_GNU_STYLE
     339# if RT_INLINE_ASM_GNU_STYLE && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
    342340    uint32_t u32Result, u32Spill;
    343     __asm__ __volatile__("mul %2\n\t"
    344                          "div %3\n\t"
     341    __asm__ __volatile__("mull %2\n\t"
     342                         "divl %3\n\t"
    345343                         : "=&a" (u32Result),
    346344                           "=&d" (u32Spill)
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