本文整理汇总了C++中UlamValue::getData方法的典型用法代码示例。如果您正苦于以下问题:C++ UlamValue::getData方法的具体用法?C++ UlamValue::getData怎么用?C++ UlamValue::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UlamValue
的用法示例。
在下文中一共展示了UlamValue::getData方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doBinaryOperationArray
//unlike NodeBinaryOp, NodeBinaryOpCompare has a node type that's different from
// its nodes, where left and right nodes are casted to be the same.
bool NodeBinaryOpCompare::doBinaryOperationArray(s32 lslot, s32 rslot, u32 slots)
{
assert(0); //not implemented yet..TODO return bool.
UlamValue rtnUV;
UTI nuti = getNodeType(); //Bool, same array size as lhs/rhs
UTI luti = m_nodeLeft->getNodeType();
UTI ruti = m_nodeRight->getNodeType();
s32 arraysize = m_state.getArraySize(luti);
assert(arraysize = m_state.getArraySize(nuti)); //node is same array size as lhs/rhs
s32 bitsize = m_state.getBitSize(luti);
UTI scalartypidx = m_state.getUlamTypeAsScalar(luti);
PACKFIT packRtn = m_state.determinePackable(nuti);
if(WritePacked(packRtn))
{
// pack result too. (slot size known ahead of time)
rtnUV = UlamValue::makeAtom(nuti); //accumulate result here
}
// point to base array slots, packedness determines its 'pos'
UlamValue lArrayPtr = UlamValue::makePtr(lslot, EVALRETURN, luti, packRtn, m_state);
UlamValue rArrayPtr = UlamValue::makePtr(rslot, EVALRETURN, ruti, packRtn, m_state);
// to use incrementPtr(), 'pos' depends on packedness
UlamValue lp = UlamValue::makeScalarPtr(lArrayPtr, m_state);
UlamValue rp = UlamValue::makeScalarPtr(rArrayPtr, m_state);
//make immediate result for each element inside loop
for(s32 i = 0; i < arraysize; i++)
{
UlamValue luv = m_state.getPtrTarget(lp);
UlamValue ruv = m_state.getPtrTarget(rp);
u32 ldata = luv.getData(lp.getPtrPos(), bitsize); //'pos' doesn't vary for unpacked
u32 rdata = ruv.getData(rp.getPtrPos(), bitsize); //'pos' doesn't vary for unpacked
if(WritePacked(packRtn))
//use calc position where base [0] is furthest from the end.
appendBinaryOp(rtnUV, ldata, rdata, (BITSPERATOM-(bitsize * (arraysize - i))), bitsize);
else
{
rtnUV = makeImmediateBinaryOp(scalartypidx, ldata, rdata, bitsize);
//cp result UV to stack, -1 (first array element deepest) relative to current frame pointer
m_state.m_nodeEvalStack.storeUlamValueInSlot(rtnUV, -slots + i);
}
assert(lp.incrementPtr(m_state));
assert(rp.incrementPtr(m_state));
} //forloop
if(WritePacked(packRtn))
m_state.m_nodeEvalStack.storeUlamValueInSlot(rtnUV, -1); //store accumulated packed result
return false;
} //end dobinaryoparray