• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ Align函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中Align函数的典型用法代码示例。如果您正苦于以下问题:C++ Align函数的具体用法?C++ Align怎么用?C++ Align使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了Align函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: Rotate

void moQuaternion<Real>::DecomposeTwistTimesSwing (
    const moVector3<Real>& rkV1, moQuaternion& rkTwist, moQuaternion& rkSwing)
{
    moVector3<Real> kV2 = Rotate(rkV1);
    rkSwing = Align(rkV1,kV2);
    rkTwist = (*this)*rkSwing.Conjugate();
}
开发者ID:inaes-tic,项目名称:tv-libmoldeo,代码行数:7,代码来源:moMathQuaternion.cpp


示例2: PadByteStream

void PadByteStream(TArray<uint8>& CompressedByteStream, const int32 Alignment, uint8 sentinel)
{
	int32 Pad = Align( CompressedByteStream.Num(), 4 ) - CompressedByteStream.Num();
	for ( int32 i = 0 ; i < Pad ; ++i )
	{
		CompressedByteStream.Add(sentinel);
	}
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:8,代码来源:AnimCompress.cpp


示例3: Align

void UTexAligner::Align( UWorld* InWorld, ETexAlign InTexAlignType )
{
	for( int32 LevelIndex = 0; LevelIndex < InWorld->GetNumLevels(); ++LevelIndex )
	{
		ULevel* Level = InWorld->GetLevel(LevelIndex);
		Align( InWorld, InTexAlignType, Level->Model );
	}
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:8,代码来源:TexAlignTools.cpp


示例4: Align

void SeeDif::InsertDialog(Interactor* dialog)
{
  World *world=GetWorld();

  Coord x,y;
  Align(Center, 0, 0, x , y);
  world->InsertTransient(dialog, this, x, y, Center);
}
开发者ID:JohnDMcMaster,项目名称:ocean,代码行数:8,代码来源:SeeDif.c


示例5: m_alignedPerDrawConstantBufferSize

DynamicConstantBuffer::DynamicConstantBuffer(UINT constantSize, UINT maxDrawsPerFrame, UINT frameCount) :
	m_alignedPerDrawConstantBufferSize(Align(constantSize)),	// Constant buffers must be aligned for hardware requirements.
	m_maxDrawsPerFrame(maxDrawsPerFrame),
	m_frameCount(frameCount),
	m_constantBuffer(nullptr)
{
	m_perFrameConstantBufferSize = m_alignedPerDrawConstantBufferSize * m_maxDrawsPerFrame;
}
开发者ID:fdyjfd,项目名称:DirectX-Graphics-Samples,代码行数:8,代码来源:DynamicConstantBuffer.cpp


示例6: Compact

	/**
	 * Compact the list down to the smallest block size boundary.
	 */
	FORCEINLINE void Compact()
	{
		uint capacity = Align(this->items, S);
		if (capacity >= this->capacity) return;

		this->capacity = capacity;
		this->data = ReallocT(this->data, this->capacity);
	}
开发者ID:dolly22,项目名称:openttd-sai,代码行数:11,代码来源:smallvec_type.hpp


示例7: CROSSNET_ASSERT

// As you can see, we can free a single block of memory at any time without being inside a GC
void GCAllocator::Free(void * ptr, int size)
{
    CROSSNET_ASSERT(IsAligned(ptr), "");

    AllocStructure * freedPtr = static_cast<AllocStructure *>(ptr);
    int alignedSize = Align(size);
    InternalFree(freedPtr, alignedSize);
}
开发者ID:KonajuGames,项目名称:CrossNet,代码行数:9,代码来源:GCAllocator.cpp


示例8:

namespace D3D12RHI
{
	/** Sizes of constant buffers defined in ED3D11ShaderOffsetBuffer. */
	const uint32 GConstantBufferSizes[MAX_CONSTANT_BUFFER_SLOTS] =
	{
		// CBs must be a multiple of 16
		(uint32)Align(MAX_GLOBAL_CONSTANT_BUFFER_SIZE, 16),
	};
}
开发者ID:RandomDeveloperM,项目名称:UE4_Hairworks,代码行数:9,代码来源:D3D12ConstantBuffer.cpp


示例9: s3c_mfc_get_data_buf_phys_addr

unsigned int s3c_mfc_get_data_buf_phys_addr()
{
    unsigned int phys_addr;

    s3c_mfc_phys_data_buf = s3c_mfc_get_risc_buf_phys_addr(MFC_MAX_INSTANCE_NUM);
    phys_addr = Align(s3c_mfc_phys_data_buf, 4*BUF_L_UNIT);

    return phys_addr;
}
开发者ID:rubensollie,项目名称:Eclair-Kernel,代码行数:9,代码来源:s3c_mfc_memory.c


示例10: DefineGlobal

void DefineGlobal(Symbol p)
{
	Align(p);
	if (p->sclass != TK_STATIC)
	{
		Export(p);
	}
	Print("%s:\t", GetAccessName(p));
}
开发者ID:descent,项目名称:ucc-code,代码行数:9,代码来源:x86linux.c


示例11: GetWorld

void Sted::InsertDialog (Interactor* dialog) {
    World* world = GetWorld();

    Coord x, y;
    Align(Center, 0, 0, x, y);
    GetRelative(x, y, world);

    world->InsertTransient(dialog, this, x, y, Center);
}
开发者ID:LambdaCalculus379,项目名称:SLS-1.02,代码行数:9,代码来源:Sted.c


示例12: tag

bool TextStyleData::readProperties(XmlReader& e)
      {
      const QStringRef& tag(e.name());

      if (tag == "name")
            name = e.readElementText();
      else if (tag == "family")
            family = e.readElementText();
      else if (tag == "size")
            size = e.readDouble();
      else if (tag == "bold")
            bold = e.readInt();
      else if (tag == "italic")
            italic = e.readInt();
      else if (tag == "underline")
            underline = e.readInt();
      else if (tag == "align")
            setAlign(Align(e.readInt()));
      else if (tag == "anchor")     // obsolete
            e.skipCurrentElement();
      else if (ElementLayout::readProperties(e))
            ;
      else if (tag == "sizeIsSpatiumDependent" || tag == "spatiumSizeDependent")
            sizeIsSpatiumDependent = e.readInt();
      else if (tag == "frameWidth") { // obsolete
            hasFrame = true;
            frameWidthMM = e.readDouble();
            }
      else if (tag == "frameWidthS") {
            hasFrame = true;
            frameWidth = Spatium(e.readDouble());
            }
      else if (tag == "frame")
            hasFrame = e.readInt();
      else if (tag == "square")
            _square = e.readInt();
      else if (tag == "paddingWidth")          // obsolete
            paddingWidthMM = e.readDouble();
      else if (tag == "paddingWidthS")
            paddingWidth = Spatium(e.readDouble());
      else if (tag == "frameRound")
            frameRound = e.readInt();
      else if (tag == "frameColor")
            frameColor = e.readColor();
      else if (tag == "foregroundColor")
            foregroundColor = e.readColor();
      else if (tag == "backgroundColor")
            backgroundColor = e.readColor();
      else if (tag == "circle")
            circle = e.readInt();
      else if (tag == "systemFlag")
            systemFlag = e.readInt();
      else
            return false;
      return true;
      }
开发者ID:AntonioBL,项目名称:MuseScore,代码行数:56,代码来源:textstyle.cpp


示例13: Align

void LibFiles::WriteFiles(FILE *stream, ObjInt align)
{
    int i =0;
    for (FileIterator it = FileBegin(); it != FileEnd(); ++it)
    {
        Align(stream, align);
        (*it)->offset = ftell(stream);
        WriteData(stream, (*it)->data, (*it)->name);
    }
}
开发者ID:doniexun,项目名称:OrangeC,代码行数:10,代码来源:LibFilesLibrarian.cpp


示例14: DefineFloatConstant

void DefineFloatConstant(Symbol p)
{
	int align = p->ty->align;

	p->aname = FormatName(".flt%d", FloatNum++);
	
	Align(p);
	Print("%s:\t", p->aname);
	DefineValue(p->ty, p->val);
}
开发者ID:descent,项目名称:ucc-code,代码行数:10,代码来源:x86linux.c


示例15: guard

// This method will grow array's MaxCount. No items will be allocated.
// The allocated memory is not initialized because items could be inserted
// and removed at any time - so initialization should be performed in
// upper level functions like Insert()
void FArray::GrowArray(int count, int elementSize)
{
	guard(FArray::GrowArray);
	assert(count > 0);

	int prevCount = MaxCount;

	// check for available space
	int newCount = DataCount + count;
	if (newCount > MaxCount)
	{
		// Not enough space, resize ...
		// Allow small initial size of array
		const int minCount = 4;
		if (newCount > minCount)
		{
			MaxCount = Align(DataCount + count, 16) + 16;
		}
		else
		{
			MaxCount = minCount;
		}
		// Align memory block to reduce fragmentation
		int dataSize = Align(MaxCount * elementSize, 16);
		// Recompute MaxCount in a case if alignment increases its capacity
		MaxCount = dataSize / elementSize;
		// Reallocate memory
		if (!IsStatic())
		{
			DataPtr = appRealloc(DataPtr, dataSize);
		}
		else
		{
			// "static" array becomes non-static
			void* oldData = DataPtr; // this is a static pointer
			DataPtr = appMalloc(dataSize);
			memcpy(DataPtr, oldData, prevCount * elementSize);
		}
	}

	unguardf("%d x %d", count, elementSize);
}
开发者ID:gildor2,项目名称:UModel,代码行数:46,代码来源:UnCore.cpp


示例16: IfFailRet

HRESULT DataTargetReader::SkipPointer()
{
    HRESULT hr = S_OK;
    if (m_remotePointerSize == 0)
    {
        IfFailRet(GetRemotePointerSize(&m_remotePointerSize));
    }
    _ASSERTE(m_remotePointerSize == 4 || m_remotePointerSize == 8);
    Align(m_remotePointerSize);
    return SkipBytes(m_remotePointerSize);
}
开发者ID:0-wiz-0,项目名称:coreclr,代码行数:11,代码来源:datatargetreader.cpp


示例17: RdrSmb2EncodeTreeConnectRequest

NTSTATUS
RdrSmb2EncodeTreeConnectRequest(
    PSMB_PACKET pPacket,
    PBYTE* ppCursor,
    PULONG pulRemaining,
    PCWSTR pwszPath
    )
{
    NTSTATUS status = STATUS_SUCCESS;
    PRDR_SMB2_TREE_CONNECT_REQUEST_HEADER pHeader = NULL;
    ULONG ulPathLength = LwRtlWC16StringNumChars(pwszPath);
    PBYTE pFilename = NULL;

    if (ulPathLength > 256)
    {
        status = STATUS_INVALID_PARAMETER;
        BAIL_ON_NT_STATUS(status);
    }

    pHeader = (PRDR_SMB2_TREE_CONNECT_REQUEST_HEADER) *ppCursor;
    /* Advance cursor past header to ensure buffer space */
    status = Advance(ppCursor, pulRemaining, sizeof(*pHeader));
    BAIL_ON_NT_STATUS(status);

    pHeader->usLength = SMB_HTOL16(sizeof(*pHeader) | 0x1);
    pHeader->usPathLength = SMB_HTOL16(ulPathLength * sizeof(WCHAR));

    /* Align to WCHAR */
    status = Align((PBYTE) pPacket->pSMB2Header, ppCursor, pulRemaining, sizeof(WCHAR));
    BAIL_ON_NT_STATUS(status);

    pFilename = *ppCursor;

    /* Fill in offset field */
    pHeader->usPathOffset = SMB_HTOL16((USHORT) PACKET_HEADER_OFFSET(pPacket, pFilename));

    /* Fill in data */
    status = Advance(ppCursor, pulRemaining, ulPathLength * sizeof(WCHAR));
    BAIL_ON_NT_STATUS(status);

    SMB_HTOLWSTR(
        pFilename,
        pwszPath,
        ulPathLength);
    BAIL_ON_NT_STATUS(status);

cleanup:

    return status;

 error:

    goto cleanup;
}
开发者ID:FarazShaikh,项目名称:LikewiseSMB2,代码行数:54,代码来源:smb2.c


示例18: Align

	/**
	 * Append an item and return it.
	 * @param to_add the number of items to append
	 * @return pointer to newly allocated item
	 */
	FORCEINLINE T *Append(uint to_add = 1)
	{
		uint begin = this->items;
		this->items += to_add;

		if (this->items > this->capacity) {
			this->capacity = Align(this->items, S);
			this->data = ReallocT(this->data, this->capacity);
		}

		return &this->data[begin];
	}
开发者ID:dolly22,项目名称:openttd-sai,代码行数:17,代码来源:smallvec_type.hpp


示例19: PadMemoryWriter

/**
 * Pads a specified number of bytes to the memory writer to maintain alignment
 */
void PadMemoryWriter(FMemoryWriter* MemoryWriter, uint8*& TrackData, const int32 Alignment)
{
	const PTRINT ByteStreamLoc = (PTRINT) TrackData;
	const int32 Pad = static_cast<int32>( Align( ByteStreamLoc, Alignment ) - ByteStreamLoc );
	const uint8 PadSentinel = 85; // (1<<1)+(1<<3)+(1<<5)+(1<<7)
	
	for ( int32 PadByteIndex = 0; PadByteIndex < Pad; ++PadByteIndex )
	{
		MemoryWriter->Serialize( (void*)&PadSentinel, sizeof(uint8) );
	}
	TrackData += Pad;
}
开发者ID:Foreven,项目名称:Unreal4-1,代码行数:15,代码来源:AnimEncoding.cpp


示例20: DEFINE_POOL_METHOD

/**
 * Resizes the pool so 'index' can be addressed
 * @param index index we will allocate later
 * @pre index >= this->size
 * @pre index < Tmax_size
 */
DEFINE_POOL_METHOD(inline void)::ResizeFor(size_t index)
{
	assert(index >= this->size);
	assert(index < Tmax_size);

	size_t new_size = ::min(Tmax_size, Align(index + 1, Tgrowth_step));

	this->data = ReallocT(this->data, new_size);
	MemSetT(this->data + this->size, 0, new_size - this->size);

	this->size = new_size;
}
开发者ID:a7omic,项目名称:OpenTTD,代码行数:18,代码来源:pool_func.hpp



注:本文中的Align函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ AlignLo函数代码示例发布时间:2022-05-30
下一篇:
C++ Alert函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap