本文整理汇总了C++中Crc32::Compute方法的典型用法代码示例。如果您正苦于以下问题:C++ Crc32::Compute方法的具体用法?C++ Crc32::Compute怎么用?C++ Crc32::Compute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Crc32
的用法示例。
在下文中一共展示了Crc32::Compute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Initialize
bool CSavestateWriter::Initialize(const CGameClient* gameClient, uint64_t frameHistoryCount)
{
m_savestate.Reset();
m_fps = 0.0;
m_fps = gameClient->Timing().GetFrameRate();
CDateTime now = CDateTime::GetCurrentDateTime();
std::string label = now.GetAsLocalizedDateTime();
m_savestate.SetType(SAVETYPE::MANUAL);
m_savestate.SetLabel(label);
m_savestate.SetGameClient(gameClient->ID());
m_savestate.SetGamePath(gameClient->GetGamePath());
m_savestate.SetTimestamp(now);
m_savestate.SetPlaytimeFrames(frameHistoryCount);
m_savestate.SetPlaytimeWallClock(frameHistoryCount / m_fps); //! @todo Accumulate playtime instead of deriving it
//! @todo Get CRC from game data instead of filename
Crc32 crc;
crc.Compute(gameClient->GetGamePath());
m_savestate.SetGameCRC(StringUtils::Format("%08x", (unsigned __int32)crc));
m_savestate.SetPath(CSavestateUtils::MakePath(m_savestate));
if (m_savestate.Path().empty())
CLog::Log(LOGDEBUG, "Failed to calculate savestate path");
if (m_fps == 0.0)
return false; // Sanity check
return !m_savestate.Path().empty();
}
示例2: sizeof
TEST(TestCrc32, Compute_1)
{
Crc32 a;
uint32_t varcrc;
a.Compute(refdata, sizeof(refdata) - 1);
varcrc = a;
EXPECT_EQ(0xa4eb60e3, varcrc);
}
示例3:
TEST(TestCrc32, Compute_2)
{
Crc32 a;
uint32_t varcrc;
CStdString s = refdata;
a.Compute(s);
varcrc = a;
EXPECT_EQ(0xa4eb60e3, varcrc);
}