VirtualBox

Changeset 11543 in vbox for trunk/src/VBox/Runtime


Ignore:
Timestamp:
Aug 21, 2008 3:35:28 PM (16 years ago)
Author:
vboxsync
Message:

tstUuid: Display the fixed bits and the value they make up.

File:
1 edited

Legend:

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

    r11539 r11543  
    106106    CHECK_EXPR(memcmp(&Uuid3, &Uuid, sizeof(Uuid)) == 0);
    107107
    108 #if 0 /** @todo make less verbose and print the bits that remain unchanged. */
    109108    /*
    110109     * checking the clock seq and time hi and version bits...
    111110     */
     111    RTUUID Uuid4Changes;
     112    Uuid4Changes.au64[0] = 0;
     113    Uuid4Changes.au64[1] = 0;
     114
     115    RTUUID Uuid4Prev;
     116    RTUuidCreate(&Uuid4Prev);
     117
    112118    for (unsigned i = 0; i < 1024; i++)
    113119    {
    114120        RTUUID Uuid4;
    115121        RTUuidCreate(&Uuid4);
     122
     123        Uuid4Changes.au64[0] |= Uuid4.au64[0] ^ Uuid4Prev.au64[0];
     124        Uuid4Changes.au64[1] |= Uuid4.au64[1] ^ Uuid4Prev.au64[1];
     125
     126#if 0   /** @todo make a bit string/dumper similar to %Rhxs/d. */
    116127        RTPrintf("tstUuid: %d %d %d %d-%d %d %d %d  %d %d %d %d-%d %d %d %d ; %d %d %d %d-%d %d %d %d  %d %d %d %d-%d %d %d %d\n",
    117128                 !!(Uuid4.Gen.u16ClockSeq & RT_BIT(0)),
     
    132143                 !!(Uuid4.Gen.u16ClockSeq & RT_BIT(15)),
    133144
    134 
    135145                 !!(Uuid4.Gen.u16TimeHiAndVersion & RT_BIT(0)),
    136146                 !!(Uuid4.Gen.u16TimeHiAndVersion & RT_BIT(1)),
     
    150160                 !!(Uuid4.Gen.u16TimeHiAndVersion & RT_BIT(15))
    151161                 );
     162#endif
     163        Uuid4Prev = Uuid4;
    152164    }
    153 #endif
     165
     166    RTUUID Uuid4Fixed;
     167    Uuid4Fixed.au64[0] = ~Uuid4Changes.au64[0];
     168    Uuid4Fixed.au64[1] = ~Uuid4Changes.au64[1];
     169    RTPrintf("tstUuid: fixed bits: %RTuuid (mask)\n", &Uuid4Fixed);
     170    RTPrintf("tstUuid:        raw: %.*Rhxs\n", sizeof(Uuid4Fixed), &Uuid4Fixed);
     171
     172    Uuid4Prev.au64[0] &= Uuid4Fixed.au64[0];
     173    Uuid4Prev.au64[1] &= Uuid4Fixed.au64[1];
     174    RTPrintf("tstUuid: fixed bits: %RTuuid (value)\n", &Uuid4Prev);
     175    RTPrintf("tstUuid:        raw: %.*Rhxs\n", sizeof(Uuid4Prev), &Uuid4Prev);
    154176
    155177    /*
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