本文整理汇总了C++中CLR_RT_HeapBlock::NumericByRef方法的典型用法代码示例。如果您正苦于以下问题:C++ CLR_RT_HeapBlock::NumericByRef方法的具体用法?C++ CLR_RT_HeapBlock::NumericByRef怎么用?C++ CLR_RT_HeapBlock::NumericByRef使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CLR_RT_HeapBlock
的用法示例。
在下文中一共展示了CLR_RT_HeapBlock::NumericByRef方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GetValuePtr
CLR_INT64* Library_corlib_native_System_TimeSpan::GetValuePtr( CLR_RT_HeapBlock& ref )
{
NATIVE_PROFILE_CLR_CORE();
CLR_RT_HeapBlock* obj = &ref;
CLR_DataType dt = obj->DataType();
if(dt == DATATYPE_OBJECT || dt == DATATYPE_BYREF)
{
obj = obj->Dereference(); if(!obj) return NULL;
dt = obj->DataType();
}
if(dt == DATATYPE_TIMESPAN)
{
return (CLR_INT64*)&obj->NumericByRef().s8;
}
if(dt == DATATYPE_I8)
{
return (CLR_INT64*)&obj->NumericByRef().s8;
}
if(dt == DATATYPE_VALUETYPE && obj->ObjectCls().m_data == g_CLR_RT_WellKnownTypes.m_TimeSpan.m_data)
{
return (CLR_INT64*)&obj[ FIELD__m_ticks ].NumericByRef().s8;
}
return NULL;
}
示例2: Wait
HRESULT Library_corlib_native_System_Threading_WaitHandle::Wait( CLR_RT_StackFrame& stack, CLR_RT_HeapBlock& blkTimeout, CLR_RT_HeapBlock& blkExitContext, CLR_RT_HeapBlock* objects, int cObjects, bool fWaitAll )
{
NATIVE_PROFILE_CLR_CORE();
TINYCLR_HEADER();
CLR_INT64 timeExpire;
TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.InitTimeout( timeExpire, blkTimeout.NumericByRef().s4 ));
TINYCLR_CHECK_HRESULT(CLR_RT_HeapBlock_WaitForObject::WaitForSignal( stack, timeExpire, objects, cObjects, fWaitAll ));
TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:13,代码来源:corlib_native_System_Threading_WaitHandle.cpp
示例3:
HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_HardwareProvider::NativeIsSupportedBaudRate___BOOLEAN__I4__BYREF_U4( CLR_RT_StackFrame& stack )
{
TINYCLR_HEADER();
CLR_RT_HeapBlock hbBR;
CLR_UINT32 port;
CLR_UINT32 SupportedBaudrate;
port = stack.Arg1().NumericByRef().u4;
TINYCLR_CHECK_HRESULT(hbBR.LoadFromReference( stack.Arg2() ));
SupportedBaudrate = hbBR.NumericByRef().u4;
if (CPU_USART_IsBaudrateSupported(port,SupportedBaudrate) == TRUE)
stack.SetResult_Boolean( true );
else
stack.SetResult_Boolean( false );
hbBR.SetInteger( (CLR_UINT32)SupportedBaudrate );
TINYCLR_CHECK_HRESULT(hbBR.StoreToReference( stack.Arg2(), 0 ));
TINYCLR_NOCLEANUP();
}
开发者ID:Wampamba-Nooh,项目名称:MicroFrameworkSDK-Mono,代码行数:23,代码来源:spot_hardware_native_Microsoft_SPOT_Hardware_HardwareProvider.cpp
示例4: SetupTimeout
HRESULT CLR_RT_StackFrame::SetupTimeout( CLR_RT_HeapBlock& input, CLR_INT64*& output )
{
NATIVE_PROFILE_CLR_CORE();
TINYCLR_HEADER();
if(m_customState == 0)
{
CLR_RT_HeapBlock& ref = PushValueAndClear();
CLR_INT64 timeExpire;
//
// Initialize timeout and save it on the stack.
//
TINYCLR_CHECK_HRESULT(g_CLR_RT_ExecutionEngine.InitTimeout( timeExpire, input.NumericByRef().s4 ));
ref.SetInteger( timeExpire );
m_customState = 1;
}
output = (CLR_INT64*)&m_evalStack[ 0 ].NumericByRef().s8;
TINYCLR_NOCLEANUP();
}
示例5:
HRESULT Library_spot_net_native_Microsoft_SPOT_Net_SocketNative::ioctl___STATIC__VOID__OBJECT__U4__BYREF_U4( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_NETWORK();
TINYCLR_HEADER();
CLR_RT_HeapBlock* socket = stack.Arg0().Dereference();
CLR_INT32 handle;
CLR_INT32 cmd = stack.Arg1().NumericByRef().s4;
CLR_RT_HeapBlock blkArg;
CLR_INT32 ret;
FAULT_ON_NULL(socket);
handle = socket[ FIELD__m_Handle ].NumericByRef().s4;
_SIDE_ASSERTE(SUCCEEDED(blkArg.LoadFromReference( stack.Arg2() )));
ret = SOCK_ioctl( handle, cmd, (CLR_INT32*)&blkArg.NumericByRef().s4 );
TINYCLR_CHECK_HRESULT(ThrowOnError( stack, ret ));
_SIDE_ASSERTE(SUCCEEDED(blkArg.StoreToReference( stack.Arg2(), 0 )));
TINYCLR_NOCLEANUP();
}
开发者ID:Wampamba-Nooh,项目名称:MicroFrameworkSDK-Mono,代码行数:24,代码来源:spot_net_native_Microsoft_SPOT_Net_SocketNative.cpp
示例6: SetValue___VOID__OBJECT__OBJECT
HRESULT Library_corlib_native_System_Reflection_FieldInfo::SetValue___VOID__OBJECT__OBJECT( CLR_RT_StackFrame& stack )
{
NATIVE_PROFILE_CLR_CORE();
TINYCLR_HEADER();
CLR_RT_FieldDef_Instance instFD;
CLR_RT_TypeDef_Instance instTD;
CLR_RT_TypeDescriptor instTDescObj;
CLR_RT_TypeDef_Instance instTDField;
const CLR_RECORD_FIELDDEF* fd;
CLR_RT_HeapBlock* obj;
bool fValueType;
CLR_RT_HeapBlock& srcVal = stack.Arg2();
CLR_RT_HeapBlock& srcObj = stack.Arg1();
CLR_RT_HeapBlock val; val.Assign( srcVal );
CLR_RT_ProtectFromGC gc( val );
TINYCLR_CHECK_HRESULT(Library_corlib_native_System_Reflection_FieldInfo::Initialize( stack, instFD, instTD, obj ));
fd = instFD.m_target;
if(fd->flags & CLR_RECORD_FIELDDEF::FD_NoReflection) // don't allow reflection for fields with NoReflection attribute
{
TINYCLR_SET_AND_LEAVE(CLR_E_NOT_SUPPORTED);
}
TINYCLR_CHECK_HRESULT(instTDescObj.InitializeFromFieldDefinition(instFD));
// make sure the right side object is of the same type as the left side
if(NULL != val.Dereference() && !CLR_RT_ExecutionEngine::IsInstanceOf(val, instTDescObj.m_handlerCls)) TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
fValueType = obj->IsAValueType();
if(fValueType || (c_CLR_RT_DataTypeLookup[ obj->DataType() ].m_flags & CLR_RT_DataTypeLookup::c_OptimizedValueType))
{
if(val.Dereference() == NULL || !val.Dereference()->IsBoxed()) TINYCLR_SET_AND_LEAVE(CLR_E_WRONG_TYPE);
if(fValueType)
{
_ASSERTE(NULL != obj->Dereference());
if(NULL == obj->Dereference()) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);
instTDField.InitializeFromIndex( obj->Dereference()->ObjectCls() );
}
else
{
instTDField.InitializeFromIndex( *c_CLR_RT_DataTypeLookup[ obj->DataType() ].m_cls );
}
TINYCLR_CHECK_HRESULT(val.PerformUnboxing( instTDField ));
}
else
{
#if defined(TINYCLR_APPDOMAINS)
if(srcObj.IsTransparentProxy())
{
_ASSERTE(srcObj.DataType() == DATATYPE_OBJECT);
_ASSERTE(srcObj.Dereference() != NULL && srcObj.Dereference()->DataType() == DATATYPE_TRANSPARENT_PROXY);
TINYCLR_CHECK_HRESULT(srcObj.Dereference()->TransparentProxyValidate());
TINYCLR_CHECK_HRESULT(srcObj.Dereference()->TransparentProxyAppDomain()->MarshalObject( val, val ));
}
#endif
}
switch(obj->DataType())
{
case DATATYPE_DATETIME: // Special case.
case DATATYPE_TIMESPAN: // Special case.
obj->NumericByRef().s8 = val.NumericByRefConst().s8;
break;
default:
obj->Assign( val );
break;
}
TINYCLR_NOCLEANUP();
}
开发者ID:AustinWise,项目名称:Netduino-Micro-Framework,代码行数:78,代码来源:corlib_native_System_Reflection_FieldInfo.cpp
示例7: IndexOf
/*
This is not the same functionality as System.Array.IndexOf. CLR_RT_HeapBlock_Array::IndexOf does the search analogous
to calling Object.ReferenceEquals, not Object.Equals, as System.Array.IndexOf demands. This function is used by
TrySzIndexOf
*/
HRESULT CLR_RT_HeapBlock_Array::IndexOf( CLR_RT_HeapBlock_Array* array, CLR_RT_HeapBlock& match, int start, int stop, bool fForward, int& index )
{
NATIVE_PROFILE_CLR_CORE();
TINYCLR_HEADER();
int numElem = array->m_numOfElements;
int count;
if(stop == -1) stop = numElem;
count = stop - start;
if(CheckRange( start, count, numElem ) == false) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
if(count > 0)
{
CLR_UINT8* data = array->GetFirstElement();
CLR_UINT8 sizeElem = array->m_sizeOfElement;
int pos;
int incr;
if(fForward) { pos = start ; incr = 1; }
else { pos = stop-1; incr = -1; }
data += pos * sizeElem;
if(!array->m_fReference)
{
CLR_RT_HeapBlock* matchPtr = match.FixBoxingReference(); FAULT_ON_NULL(matchPtr);
if(matchPtr->DataType() <= DATATYPE_LAST_PRIMITIVE)
{
int incrElem = incr * sizeElem;
while(true)
{
#if !defined(BIG_ENDIAN)
if(memcmp( data, &matchPtr->NumericByRef(), sizeElem ) == 0)
{
index = pos;
TINYCLR_SET_AND_LEAVE(S_OK);
}
#else
CLR_UINT64 refNum;
switch(sizeElem)
{
case 1:
refNum = matchPtr->NumericByRef().u1;
break;
case 2:
refNum = matchPtr->NumericByRef().u2;
break;
case 4:
refNum = matchPtr->NumericByRef().u4;
break;
case 8:
refNum = matchPtr->NumericByRef().u8;
break;
}
if(memcmp( data, &refNum, sizeElem ) == 0)
{
index = pos;
TINYCLR_SET_AND_LEAVE(S_OK);
}
#endif
if(--count == 0) break;
pos += incr;
data += incrElem;
}
}
}
else
{
CLR_RT_HeapBlock* dataPtr = (CLR_RT_HeapBlock*)data;
while(true)
{
if(CLR_RT_HeapBlock::Compare_Unsigned_Values( *dataPtr, match ) == 0)
{
index = pos;
TINYCLR_SET_AND_LEAVE(S_OK);
}
if(--count == 0) break;
pos += incr;
dataPtr += incr;
}
}
}
//.........这里部分代码省略.........