VirtualBox

Changeset 58712 in vbox


Ignore:
Timestamp:
Nov 16, 2015 10:51:00 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
104140
Message:

iprt/asm.h: 16-bit and 32-bit Watcom C/C++ adjustments.

File:
1 edited

Legend:

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

    r58706 r58712  
    187187#elif RT_INLINE_ASM_USES_INTRIN
    188188# define ASMCompilerBarrier()   do { _ReadWriteBarrier(); } while (0)
     189#elif defined(__WATCOMC__)
     190void ASMCompilerBarrier(void);
    189191#else /* 2003 should have _ReadWriteBarrier() but I guess we're at 2002 level then... */
    190192DECLINLINE(void) ASMCompilerBarrier(void)
     
    44784480 */
    44794481#if RT_INLINE_ASM_EXTERNAL
    4480 DECLASM(int) ASMBitFirstClear(const volatile void *pvBitmap, uint32_t cBits);
    4481 #else
    4482 DECLINLINE(int) ASMBitFirstClear(const volatile void *pvBitmap, uint32_t cBits)
     4482DECLASM(int32_t) ASMBitFirstClear(const volatile void *pvBitmap, uint32_t cBits);
     4483#else
     4484DECLINLINE(int32_t) ASMBitFirstClear(const volatile void *pvBitmap, uint32_t cBits)
    44834485{
    44844486    if (cBits)
     
    46334635 */
    46344636#if RT_INLINE_ASM_EXTERNAL
    4635 DECLASM(int) ASMBitFirstSet(const volatile void *pvBitmap, uint32_t cBits);
    4636 #else
    4637 DECLINLINE(int) ASMBitFirstSet(const volatile void *pvBitmap, uint32_t cBits)
     4637DECLASM(int32_t) ASMBitFirstSet(const volatile void *pvBitmap, uint32_t cBits);
     4638#else
     4639DECLINLINE(int32_t) ASMBitFirstSet(const volatile void *pvBitmap, uint32_t cBits)
    46384640{
    46394641    if (cBits)
     
    49884990 * @param   cShift              How many bits to rotate by.
    49894991 */
     4992#ifdef __WATCOMC__
     4993DECLASM(uint32_t) ASMRotateLeftU32(uint32_t u32, unsigned cShift);
     4994#else
    49904995DECLINLINE(uint32_t) ASMRotateLeftU32(uint32_t u32, uint32_t cShift)
    49914996{
    4992 #if RT_INLINE_ASM_USES_INTRIN
     4997# if RT_INLINE_ASM_USES_INTRIN
    49934998    return _rotl(u32, cShift);
    4994 #elif RT_INLINE_ASM_GNU_STYLE && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
     4999# elif RT_INLINE_ASM_GNU_STYLE && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
    49955000    __asm__ __volatile__("roll %b1, %0" : "=g" (u32) : "Ic" (cShift), "0" (u32));
    49965001    return u32;
    4997 #else
     5002# else
    49985003    cShift &= 31;
    49995004    return (u32 << cShift) | (u32 >> (32 - cShift));
    5000 #endif
    5001 }
     5005# endif
     5006}
     5007#endif
    50025008
    50035009
     
    50095015 * @param   cShift              How many bits to rotate by.
    50105016 */
     5017#ifdef __WATCOMC__
     5018DECLASM(uint32_t) ASMRotateRightU32(uint32_t u32, unsigned cShift);
     5019#else
    50115020DECLINLINE(uint32_t) ASMRotateRightU32(uint32_t u32, uint32_t cShift)
    50125021{
    5013 #if RT_INLINE_ASM_USES_INTRIN
     5022# if RT_INLINE_ASM_USES_INTRIN
    50145023    return _rotr(u32, cShift);
    5015 #elif RT_INLINE_ASM_GNU_STYLE && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
     5024# elif RT_INLINE_ASM_GNU_STYLE && (defined(RT_ARCH_AMD64) || defined(RT_ARCH_X86))
    50165025    __asm__ __volatile__("rorl %b1, %0" : "=g" (u32) : "Ic" (cShift), "0" (u32));
    50175026    return u32;
    5018 #else
     5027# else
    50195028    cShift &= 31;
    50205029    return (u32 >> cShift) | (u32 << (32 - cShift));
    5021 #endif
    5022 }
     5030# endif
     5031}
     5032#endif
    50235033
    50245034
     
    50995109
    51005110
     5111/*
     5112 * Include #pragma aux definitions for Watcom C/C++.
     5113 */
     5114#if defined(__WATCOMC__) && ARCH_BITS == 16 && defined(RT_ARCH_X86)
     5115# include "asm-watcom-x86-16.h"
     5116#elif defined(__WATCOMC__) && ARCH_BITS == 32 && defined(RT_ARCH_X86)
     5117# include "asm-watcom-x86-32.h"
     5118#endif
     5119
     5120
    51015121/** @} */
    51025122
Note: See TracChangeset for help on using the changeset viewer.

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