VirtualBox

Changeset 21919 in vbox


Ignore:
Timestamp:
Jul 31, 2009 3:43:18 PM (15 years ago)
Author:
vboxsync
Message:

iprt/crc32.cpp: strip docs, coding style.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Runtime/common/checksum/crc32.cpp

    r21337 r21919  
    55
    66/*
    7  * Copyright (C) 2006-2007 Sun Microsystems, Inc.
     7 * Copyright (C) 2006-2009 Sun Microsystems, Inc.
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    8787#else
    8888/** CRC32 feedback table. */
    89 uint32_t au32CRC32[] =
     89static uint32_t const g_au32CRC32[] =
    9090{
    9191#endif
     
    155155
    156156
    157 /**
    158  * Calculate CRC32 for a memory block.
    159  *
    160  * @returns CRC32 for the memory block.
    161  * @param   pv      Pointer to the memory block.
    162  * @param   cb      Size of the memory block in bytes.
    163  */
    164157RTDECL(uint32_t) RTCrc32(const void *pv, size_t cb)
    165158{
     
    167160    uint32_t        uCRC32 = ~0U;
    168161    while (cb--)
    169         uCRC32 = au32CRC32[(uCRC32 ^ *pu8++) & 0xff] ^ (uCRC32 >> 8);
     162        uCRC32 = g_au32CRC32[(uCRC32 ^ *pu8++) & 0xff] ^ (uCRC32 >> 8);
    170163    return uCRC32 ^ ~0U;
    171164}
     
    173166
    174167
    175 /**
    176  * Start a multiblock CRC32 calculation.
    177  *
    178  * @returns Start CRC32.
    179  */
    180168RTDECL(uint32_t) RTCrc32Start(void)
    181169{
     
    185173
    186174
    187 /**
    188  * Processes a multiblock of a CRC32 calculation.
    189  *
    190  * @returns Intermediate CRC32 value.
    191  * @param   uCRC32  Current CRC32 intermediate value.
    192  * @param   pv      The data block to process.
    193  * @param   cb      The size of the data block in bytes.
    194  */
    195175RTDECL(uint32_t) RTCrc32Process(uint32_t uCRC32, const void *pv, size_t cb)
    196176{
    197177    const uint8_t  *pu8 = (const uint8_t *)pv;
    198178    while (cb--)
    199         uCRC32 = au32CRC32[(uCRC32 ^ *pu8++) & 0xff] ^ (uCRC32 >> 8);
     179        uCRC32 = g_au32CRC32[(uCRC32 ^ *pu8++) & 0xff] ^ (uCRC32 >> 8);
    200180    return uCRC32;
    201181}
     
    203183
    204184
    205 /**
    206  * Complete a multiblock CRC32 calculation.
    207  *
    208  * @returns CRC32 value.
    209  * @param   uCRC32  Current CRC32 intermediate value.
    210  */
    211185RTDECL(uint32_t) RTCrc32Finish(uint32_t uCRC32)
    212186{
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