VirtualBox

Changeset 7633 in vbox


Ignore:
Timestamp:
Mar 28, 2008 5:07:09 PM (17 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
29137
Message:

ASMMemIsAllU32

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/iprt/asm.h

    r7182 r7633  
    38703870DECLINLINE(void *) ASMMemIsAll8(void const *pv, size_t cb, uint8_t u8)
    38713871{
    3872 /** @todo rewrite this in inline assembly. */
     3872/** @todo rewrite this in inline assembly? */
    38733873    uint8_t const *pb = (uint8_t const *)pv;
    38743874    for (; cb; cb--, pb++)
     
    38793879#endif
    38803880
     3881
     3882/**
     3883 * Checks if a memory block is filled with the specified 32-bit value.
     3884 *
     3885 * This is a sort of inverted memchr.
     3886 *
     3887 * @returns Pointer to the first value which doesn't equal u32.
     3888 * @returns NULL if all equal to u32.
     3889 *
     3890 * @param   pv      Pointer to the memory block.
     3891 * @param   cb      Number of bytes in the block. This MUST be aligned on 32-bit!
     3892 * @param   u32     The value it's supposed to be filled with.
     3893 */
     3894#if RT_INLINE_ASM_EXTERNAL && !RT_INLINE_ASM_USES_INTRIN
     3895DECLASM(uint32_t *) ASMMemIsAllU32(void const *pv, size_t cb, uint32_t u32);
     3896#else
     3897DECLINLINE(uint32_t *) ASMMemIsAllU32(void const *pv, size_t cb, uint32_t u32)
     3898{
     3899/** @todo rewrite this in inline assembly? */
     3900    uint32_t const *pu32 = (uint32_t const *)pv;
     3901    for (; cb; cb -= 4, pu32++)
     3902        if (RT_UNLIKELY(*pu32 != u32))
     3903            return (uint32_t *)pu32;
     3904    return NULL;
     3905}
     3906#endif
    38813907
    38823908
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