VirtualBox

Changeset 57647 in vbox for trunk


Ignore:
Timestamp:
Sep 7, 2015 4:39:39 PM (9 years ago)
Author:
vboxsync
Message:

fixed bug in ASMBitSetRange()

Location:
trunk
Files:
2 edited

Legend:

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

    r56291 r57647  
    43634363        int iEnd   = iBitEnd & ~31;
    43644364        if (iStart == iEnd)
    4365             *pu32 |= ((1 << (iBitEnd - iBitStart)) - 1) << iBitStart;
     4365            *pu32 |= ((1 << (iBitEnd - iBitStart)) - 1) << (iBitStart & 31);
    43664366        else
    43674367        {
  • trunk/src/VBox/Runtime/testcase/tstRTBitOperations.cpp

    r57358 r57647  
    164164    CHECK_GUARD(p);
    165165
    166     /* set */
     166    /* bit set */
    167167    MAP_CLEAR(p);
    168168    ASMBitSet(&p->au32[0], 0);
     
    187187    CHECK(!ASMAtomicBitTestAndSet(&p->au32[0], 80) && p->au32[2] == 0x00010001U);
    188188
    189     /* clear */
     189    /* bit clear */
    190190    MAP_SET(p);
    191191    ASMBitClear(&p->au32[0], 0);
     
    209209    CHECK(!ASMAtomicBitTestAndClear(&p->au32[0], 16)  && p->au32[0] == ~0x40010001U);
    210210    CHECK(ASMAtomicBitTestAndClear(&p->au32[0], 80)   && p->au32[2] == ~0x00010001U);
     211
     212    /* range set */
     213    MAP_CLEAR(p);
     214    ASMBitSetRange(&p->au32[0], 0, 5);
     215    ASMBitSetRange(&p->au32[0], 6, 44);
     216    ASMBitSetRange(&p->au32[0], 64, 65);
     217    CHECK(p->au32[0] == 0xFFFFFFDFU);
     218    CHECK(p->au32[1] == 0x00000FFFU);
     219    CHECK(p->au32[2] == 0x00000001U);
    211220
    212221    /* toggle */
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