VirtualBox

Changeset 57648 in vbox for trunk


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

tstRTBitOperations: Alternative ASMBitSetRange test variant that tries to force the compiler to no precalculate the results, thus presumably better reflecting current use.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/testcase/tstRTBitOperations.cpp

    r57647 r57648  
    210210    CHECK(ASMAtomicBitTestAndClear(&p->au32[0], 80)   && p->au32[2] == ~0x00010001U);
    211211
    212     /* range set */
     212    /* set range */
    213213    MAP_CLEAR(p);
    214214    ASMBitSetRange(&p->au32[0], 0, 5);
    215215    ASMBitSetRange(&p->au32[0], 6, 44);
    216216    ASMBitSetRange(&p->au32[0], 64, 65);
    217     CHECK(p->au32[0] == 0xFFFFFFDFU);
    218     CHECK(p->au32[1] == 0x00000FFFU);
    219     CHECK(p->au32[2] == 0x00000001U);
     217    CHECK(p->au32[0] == UINT32_C(0xFFFFFFDF));
     218    CHECK(p->au32[1] == UINT32_C(0x00000FFF));
     219    CHECK(p->au32[2] == UINT32_C(0x00000001));
     220
     221    MAP_CLEAR(p);
     222    volatile int iLow = 0;
     223    volatile int iHigh = 5;
     224    ASMBitSetRange(&p->au32[0], iLow, iHigh);
     225    iLow = 6; iHigh = 44;
     226    ASMBitSetRange(&p->au32[0], iLow, iHigh);
     227    iLow = 64; iHigh = 65;
     228    ASMBitSetRange(&p->au32[0], iLow, iHigh);
     229    CHECK(p->au32[0] == UINT32_C(0xFFFFFFDF));
     230    CHECK(p->au32[1] == UINT32_C(0x00000FFF));
     231    CHECK(p->au32[2] == UINT32_C(0x00000001));
    220232
    221233    /* 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