1.0.0.03.7z


1.0.0.03.7z
资源截图
代码片段和文件信息

/****************************************************************************

Copyright(c) 2005 by Intellon Corp. ALL RIGHTS RESERVED.

This Information is proprietary to Intellon Corporation Ocala Florida
(Intellon) and MAY NOT be copied by any method or incorporated into
another program without the express written consent of Intellon. This
Information or any portion thereof remains the property of Intellon. The
Information contained herein is believed to be accurate and Intellon
assumes no responsibility or liability for its use in any way and conveys
no license or title under any patent or copyright and makes no
representation or warranty that this Information is free from patent or
copyright infringement.


    File: CheckSum.cpp
    
    Author(s): Patrick Tse
Nozar Kianian Fard 2005/09/07
    
    Contains: CheckSum Library

--
$File: //eng/sw/panther/releases/1.1.0/main/publically_disclosed/common/CheckSum.cpp $  
$Revision: #1 $ 

$Change: 179672 $
$Author: nickk $ 
$DateTime: 2012/05/08 13:49:12 $ 
 
****************************************************************************/

#include “CheckSum.h“

// ---------------------------------------------------------------------------
//
// Function: CCCheckSum::VerifyCheckSum()
//
// ---------------------------------------------------------------------------
bool CCCheckSum::VerifyCheckSum(
const uint32* pBufferPtr
uint32 aLength_Wds
uint32 aGivenCheckSum

{
uint32 CheckSum = CCCheckSum::GenerateCheckSum( pBufferPtr aLength_Wds );

return (CheckSum == aGivenCheckSum);
}


// ---------------------------------------------------------------------------
//
// Function: CCCheckSum::GenerateCheckSum()
//
// ---------------------------------------------------------------------------
uint32 CCCheckSum::GenerateCheckSum(
const uint32* pBufferPtr
uint32 aLength_Wds

{
uint32 CheckSum;
uint32 vpBufferPtr = (uint32)pBufferPtr;

if (vpBufferPtr & 0x3)
{
CheckSum = CCCheckSum::Calc32bitXor( pBufferPtr aLength_Wds );
}
else
{
CheckSum = CCCheckSum::Calc32bitXor_address_word_aligned(pBufferPtr aLength_Wds );
}

CheckSum = FinalizeCumulativeChecksum( CheckSum );

return( CheckSum );// return Checksum

}


// ---------------------------------------------------------------------------
uint32 CCCheckSum::GenerateCumulativeChecksum( 
uint32 aAccumulatedSoFar 
const uint32 * apBufferPtr 
uint32 aLength_Wds 

{
uint32 vpBufferPtr = (uint32)apBufferPtr;
if (vpBufferPtr & 0x3)
{
return aAccumulatedSoFar ^ CCCheckSum::Calc32bitXor( apBufferPtr aLength_Wds );
}
return aAccumulatedSoFar ^ CCCheckSum::Calc32bitXor_address_word_aligned(apBufferPtr aLength_Wds );
}

uint32 CCCheckSum::FinalizeCumulativeChecksum( 
uint32 aAccumulatedSoFar 
) {
//-* One‘s Compliment *-//
return ~aAccumulatedSoFar;
}


// ----------------------------------------

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件举报,一经查实,本站将立刻删除。

发表评论

评论列表(条)