本文整理匯總了C#中ProtoCore.DSASM.StackValue.AsDouble方法的典型用法代碼示例。如果您正苦於以下問題:C# StackValue.AsDouble方法的具體用法?C# StackValue.AsDouble怎麽用?C# StackValue.AsDouble使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類ProtoCore.DSASM.StackValue
的用法示例。
在下文中一共展示了StackValue.AsDouble方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Coerce
//.........這裏部分代碼省略.........
//Upcast once
StackValue coercedValue = Coerce(sv, newTargetType, core);
GCUtils.GCRetain(coercedValue, core);
StackValue newSv = HeapUtils.StoreArray(new StackValue[] { coercedValue }, core);
return newSv;
}
}
if (sv.optype == AddressType.Pointer)
{
StackValue ret = ClassCoerece(sv, targetType, core);
return ret;
}
//If it's anything other than array, just create a new copy
switch (targetType.UID)
{
case (int)PrimitiveType.kInvalidType:
Validity.Assert(false, "Can't convert invalid type");
break;
case (int)PrimitiveType.kTypeBool:
return sv.AsBoolean(core);
case (int)PrimitiveType.kTypeChar:
{
StackValue newSV = sv.ShallowClone();
newSV.metaData = new MetaData { type = (int)PrimitiveType.kTypeChar };
return newSV;
}
case (int)PrimitiveType.kTypeDouble:
return sv.AsDouble();
case (int)PrimitiveType.kTypeFunctionPointer:
if (sv.metaData.type != (int)PrimitiveType.kTypeFunctionPointer)
{
core.RuntimeStatus.LogWarning(RuntimeData.WarningID.kTypeMismatch, ProtoCore.RuntimeData.WarningMessage.kFailToConverToFunction);
return StackUtils.BuildNull();
}
return sv.ShallowClone();
case (int)PrimitiveType.kTypeHostEntityID:
{
StackValue newSV = sv.ShallowClone();
newSV.metaData = new MetaData { type = (int)PrimitiveType.kTypeHostEntityID };
return newSV;
}
case (int)PrimitiveType.kTypeInt:
{
if (sv.metaData.type == (int)PrimitiveType.kTypeDouble)
{
core.RuntimeStatus.LogWarning(RuntimeData.WarningID.kTypeConvertionCauseInfoLoss, ProtoCore.RuntimeData.WarningMessage.kConvertDoubleToInt);
}
return sv.AsInt();
}
case (int)PrimitiveType.kTypeNull:
{
if (sv.metaData.type != (int)PrimitiveType.kTypeNull)
{
core.RuntimeStatus.LogWarning(RuntimeData.WarningID.kTypeMismatch, ProtoCore.RuntimeData.WarningMessage.kFailToConverToNull);
return StackUtils.BuildNull();
}