VirtualBox

Ignore:
Timestamp:
Mar 28, 2009 1:41:37 AM (16 years ago)
Author:
vboxsync
Message:

tstBitOperations: Use RT_ZERO instead of memset a couple of place so that it has some test coverage.

File:
1 edited

Legend:

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

    r18367 r18425  
    4646
    4747#define NIL_TEST2_ID    0
    48 #define TEST2_ID_LAST   (RT_BIT_32(28) - 1 >> 8)
     48#define TEST2_ID_LAST   ((RT_BIT_32(28) - 1) >> 8)
    4949
    5050struct TestMap2
     
    103103
    104104    /* Some simple tests first. */
    105     memset(&p2->bmChunkId[0],    0, sizeof(p2->bmChunkId));
     105    RT_ZERO(p2->bmChunkId);
    106106    RTTEST_CHECK(hTest, ASMBitFirstSet(&p2->bmChunkId[0], TEST2_ID_LAST + 1) == -1);
    107107    for (uint32_t iBit = 0; iBit <= TEST2_ID_LAST; iBit++)
     
    115115    /* The real test. */
    116116    p2->idChunkPrev = 0;
    117     memset(&p2->bmChunkId[0],    0, sizeof(p2->bmChunkId));
     117    RT_ZERO(p2->bmChunkId);
    118118    ASMBitSet(p2->bmChunkId, NIL_TEST2_ID);
    119119    uint32_t cLeft = TEST2_ID_LAST;
     
    165165#define GUARD_MAP(p)    do {  } while (0)
    166166#define CHECK_GUARD(p)  do {  } while (0)
    167 #define MAP_CLEAR(p)    do { memset(p,    0, sizeof(*(p))); GUARD_MAP(p); } while (0)
     167#define MAP_CLEAR(p)    do { RT_ZERO(*(p)); GUARD_MAP(p); } while (0)
    168168#define MAP_SET(p)      do { memset(p, 0xff, sizeof(*(p))); GUARD_MAP(p); } while (0)
    169169
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