VirtualBox

Changeset 745 in vbox


Ignore:
Timestamp:
Feb 7, 2007 12:37:08 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
18397
Message:

Use ASMBitFirstSet for check if data block is zero.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/Storage/VBoxHDD.cpp

    r710 r745  
    3636#include <iprt/file.h>
    3737#include <iprt/string.h>
     38#include <iprt/asm.h>
    3839
    3940#include "Builtins.h"
     
    16011602             * means that it's a zero block. Don't need to write anything to this
    16021603             * block if the data consists of just zeroes. */
    1603             bool fBlockZeroed = true; /* Block is zeroed flag. */
    1604             for (unsigned i = 0; i < (cbToWrite >> 2); i++)
    1605                 if (((uint32_t *)pvBuf)[i] != 0)
    1606                 {
    1607                     /* Block is not zeroed! */
    1608                     fBlockZeroed = false;
    1609                     break;
    1610                 }
    1611 
    1612             if (fBlockZeroed)
     1604            Assert(cbToWrite % 4 == 0);
     1605            if (ASMBitFirstSet((volatile void *)pvBuf, cbToWrite * 8) == -1)
    16131606            {
    16141607                pImage->paBlocks[uBlock] = VDI_IMAGE_BLOCK_ZERO;
     
    26382631
    26392632                /* Check block for data. */
    2640                 bool fBlockZeroed = true;    /* Block is zeroed flag. */
    2641                 for (unsigned i = 0; i < (cbBlock >> 2); i++)
    2642                     if (((uint32_t *)pvBuf)[i] != 0)
    2643                     {
    2644                         /* Block is not zeroed! */
    2645                         fBlockZeroed = false;
    2646                         break;
    2647                     }
    2648 
    2649                 if (!fBlockZeroed)
     2633                Assert(cbBlock % 4 == 0);
     2634                if (ASMBitFirstSet(pvBuf, cbBlock * 8) != -1)
    26502635                {
    26512636                    /* Block has a data, may be it must be moved. */
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