VirtualBox

Ignore:
Timestamp:
Feb 19, 2016 11:18:18 PM (9 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
105617
Message:

iprt/asm.h: Cleaned up the ASMMemIsAll8/U32 mess and implmeneted the former in assembly. (Found inverted usage due to bad naming in copyUtf8Block, but it is fortunately an unused method.) Replaces the complicated ASMBitFirstSet based scanning in RTSgBufIsZero with a simple call to the new ASMMemIsZero function.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/misc/sg.cpp

    r59745 r59747  
    407407}
    408408
     409
    409410RTDECL(bool) RTSgBufIsZero(PRTSGBUF pSgBuf, size_t cbCheck)
    410411{
     
    420421        if (!cbThisCheck)
    421422            break;
    422 
    423 /** @todo fix this after asm.h gets updated.    */
    424         /* Use optimized inline assembler if possible. */
    425         if (   !(cbThisCheck % 4)
    426             && cbThisCheck * 8 <= UINT32_MAX)
    427         {
    428             if (ASMBitFirstSet((volatile void *)pvBuf, (uint32_t)cbThisCheck * 8) != -1)
    429             {
    430                 fIsZero = false;
    431                 break;
    432             }
    433         }
    434         else
    435         {
    436             for (size_t i = 0; i < cbThisCheck; i++)
    437             {
    438                 char *pbBuf = (char *)pvBuf;
    439                 if (*pbBuf)
    440                 {
    441                     fIsZero = false;
    442                     break;
    443                 }
    444                 pvBuf = pbBuf + 1;
    445             }
    446 
    447             if (!fIsZero)
    448                 break;
    449         }
    450 
     423        fIsZero = ASMMemIsZero(pvBuf, cbThisCheck);
     424        if (!fIsZero)
     425            break;
    451426        cbLeft -= cbThisCheck;
    452427    }
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