コード例 #1
0
HRESULT Library_corlib_native_System_Math::Floor___STATIC__R8__R8( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_INT64 d = stack.Arg0().NumericByRefConst().r8;
    CLR_INT64 res = (CLR_INT64)( d  & (~CLR_RT_HeapBlock::HB_DoubleMask) );
    stack.SetResult_I8( res );

    TINYCLR_NOCLEANUP_NOLABEL();
}
HRESULT Library_spot_hardware_native_Microsoft_SPOT_Hardware_Cpu::get_GlitchFilterTime___STATIC__mscorlibSystemTimeSpan( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_HARDWARE();
    TINYCLR_HEADER();

    CLR_INT64 val = (CLR_INT64)::CPU_GPIO_GetDebounce() * TIME_CONVERSION__TO_MILLISECONDS;

    stack.SetResult_I8( val );
    
    stack.TopValue().ChangeDataType( DATATYPE_TIMESPAN );

    TINYCLR_NOCLEANUP_NOLABEL();
}
HRESULT Library_corlib_native_System_BitConverter::DoubleToInt64Bits___STATIC__I8__R8( CLR_RT_StackFrame& stack )
{
	NATIVE_PROFILE_CLR_CORE();
	TINYCLR_HEADER();

	double input;
	input = stack.Arg0().NumericByRefConst().r8;
	__int64* p;
	p = reinterpret_cast<__int64*>(&input);
	stack.SetResult_I8(*p);

	TINYCLR_NOCLEANUP_NOLABEL();
}
HRESULT Library_corlib_native_System_BitConverter::DoubleToInt64Bits___STATIC__I8__R8(CLR_RT_StackFrame& stack)
{
	NATIVE_PROFILE_CLR_CORE();
	TINYCLR_HEADER();

#if !defined(TINYCLR_EMULATED_FLOATINGPOINT)
	double input = stack.Arg0().NumericByRefConst().r8;
#else
	CLR_INT64 input = stack.Arg0().NumericByRefConst().r8;
#endif
	__int64* p = reinterpret_cast<__int64*>(&input);
	stack.SetResult_I8(*p);

	TINYCLR_NOCLEANUP_NOLABEL();
}
コード例 #5
0
HRESULT Library_corlib_native_System_Math::Round___STATIC__R8__R8( CLR_RT_StackFrame& stack )
{
    NATIVE_PROFILE_CLR_CORE();
    TINYCLR_HEADER();

    CLR_INT64 d = stack.Arg0().NumericByRefConst().r8;

    //for negative number we have to be banker's round, if -0.5, round to 0, but 0.5 to 0
    if (d <0) d =d + 1; 
    CLR_INT64 res = (CLR_INT64)(d + (CLR_INT64)(CLR_RT_HeapBlock::HB_DoubleMask>>1) ) & (~CLR_RT_HeapBlock::HB_DoubleMask);

    stack.SetResult_I8( res );


    TINYCLR_NOCLEANUP_NOLABEL();
}
HRESULT Library_corlib_native_System_BitConverter::ToInt64___STATIC__I8__SZARRAY_U1__I4( CLR_RT_StackFrame& stack )
{
	NATIVE_PROFILE_CLR_CORE();
	TINYCLR_HEADER();

	CLR_RT_HeapBlock_Array* pArray = stack.Arg0().DereferenceArray();
	FAULT_ON_NULL_ARG(pArray);

	int index;
	index = stack.Arg1().NumericByRefConst().s4;
	if (index < 0 || (unsigned int)index >= pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_OUT_OF_RANGE);
	if ((unsigned int)index + 8 > pArray->m_numOfElements) TINYCLR_SET_AND_LEAVE(CLR_E_INVALID_PARAMETER);

	BYTE* p;
	p  = pArray->GetFirstElement();
	stack.SetResult_I8(*reinterpret_cast<__int64*>(p + index));

	TINYCLR_NOCLEANUP();
}
HRESULT Library_windows_devices_native_Windows_Devices_Gpio_GpioPin::get_DebounceTimeout___mscorlibSystemTimeSpan( CLR_RT_StackFrame& stack )
{
    TINYCLR_HEADER();

    GPIO_PIN pin;
    CLR_INT64 value;
    CLR_RT_HeapBlock* pThis = stack.This(); FAULT_ON_NULL(pThis);

    if (pThis[ FIELD__m_disposed ].NumericByRef().s1 != 0)
    {
        TINYCLR_SET_AND_LEAVE(CLR_E_OBJECT_DISPOSED);
    }

    pin = (GPIO_PIN)( pThis[ FIELD__m_pinNumber ].NumericByRefConst().u4 );
    value = (CLR_INT64)::CPU_GPIO_GetPinDebounce( pin ) * TIME_CONVERSION__TO_MILLISECONDS;
    stack.SetResult_I8( value );
    stack.TopValue().ChangeDataType( DATATYPE_TIMESPAN );

    TINYCLR_NOCLEANUP();
}
コード例 #8
0
void SetResult_INT64( CLR_RT_StackFrame &stackFrame, INT64 value )
{
    NATIVE_PROFILE_CLR_CORE();
    stackFrame.SetResult_I8( value );
}