本文整理汇总了C++中MemoryPool::get_for_uint64_count方法的典型用法代码示例。如果您正苦于以下问题:C++ MemoryPool::get_for_uint64_count方法的具体用法?C++ MemoryPool::get_for_uint64_count怎么用?C++ MemoryPool::get_for_uint64_count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MemoryPool
的用法示例。
在下文中一共展示了MemoryPool::get_for_uint64_count方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: duplicate_poly_if_needed
ConstPointer duplicate_poly_if_needed(const std::uint64_t *poly, int coeff_count, int coeff_uint64_count, int new_coeff_count, int new_coeff_uint64_count, bool force, MemoryPool &pool)
{
#ifdef _DEBUG
if (poly == nullptr && coeff_count > 0 && coeff_uint64_count > 0)
{
throw invalid_argument("poly");
}
if (coeff_count < 0)
{
throw invalid_argument("coeff_count");
}
if (coeff_uint64_count < 0)
{
throw invalid_argument("coeff_uint64_count");
}
if (new_coeff_count < 0)
{
throw invalid_argument("new_coeff_count");
}
if (new_coeff_uint64_count < 0)
{
throw invalid_argument("new_coeff_uint64_count");
}
#endif
if (!force && coeff_count >= new_coeff_count && coeff_uint64_count == new_coeff_uint64_count)
{
return ConstPointer::Aliasing(poly);
}
Pointer allocation = pool.get_for_uint64_count(new_coeff_count * new_coeff_uint64_count);
set_poly_poly(poly, coeff_count, coeff_uint64_count, new_coeff_count, new_coeff_uint64_count, allocation.get());
ConstPointer const_allocation;
const_allocation.acquire(allocation);
return const_allocation;
}
示例2: duplicate_uint_if_needed
ConstPointer duplicate_uint_if_needed(const std::uint64_t *uint, int uint64_count, int new_uint64_count, bool force, MemoryPool &pool)
{
#ifdef _DEBUG
if (uint == nullptr && uint64_count > 0)
{
throw invalid_argument("uint");
}
if (uint64_count < 0)
{
throw invalid_argument("uint64_count");
}
if (new_uint64_count < 0)
{
throw invalid_argument("new_uint64_count");
}
#endif
if (!force && uint64_count >= new_uint64_count)
{
return ConstPointer::Aliasing(uint);
}
Pointer allocation = pool.get_for_uint64_count(new_uint64_count);
set_uint_uint(uint, uint64_count, new_uint64_count, allocation.get());
ConstPointer const_allocation;
const_allocation.acquire(allocation);
return const_allocation;
}
示例3: duplicate_if_needed
Pointer duplicate_if_needed(uint64_t *original, int uint64_count, bool condition, MemoryPool &pool)
{
#ifdef _DEBUG
if (original == nullptr && uint64_count > 0)
{
throw invalid_argument("original");
}
if (uint64_count < 0)
{
throw invalid_argument("uint64_count");
}
#endif
if (condition == false)
{
return Pointer::Aliasing(original);
}
Pointer allocation = pool.get_for_uint64_count(uint64_count);
memcpy(allocation.get(), original, uint64_count * bytes_per_uint64);
return allocation;
}