MCPcopy Create free account
hub / github.com/beefytech/Beef / ValueToInt

Method ValueToInt

IDEHelper/Compiler/CeDebugger.cpp:579–603  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

577}
578
579int64 CeDebugger::ValueToInt(addr_ce addr, BfType* type)
580{
581 if ((!type->IsInteger()) && (!type->IsBoolean()))
582 return 0;
583
584 auto primType = (BfPrimitiveType*)type;
585 auto ceContext = mCeMachine->mCurContext;
586
587 int64 val = 0;
588 memcpy(&val, ceContext->mMemory.mVals + addr, type->mSize);
589
590 switch (primType->mTypeDef->mTypeCode)
591 {
592 case BfTypeCode_Int8:
593 val = *(int8*)&val;
594 break;
595 case BfTypeCode_Int16:
596 val = *(int16*)&val;
597 break;
598 case BfTypeCode_Int32:
599 val = *(int32*)&val;
600 break;
601 }
602 return val;
603}
604
605int64 CeDebugger::ValueToInt(const BfTypedValue& typedVal)
606{

Callers 1

DoInvocationMethod · 0.80

Calls 8

IsAddrMethod · 0.80
GetConstantByIdMethod · 0.80
IsIntegerMethod · 0.45
IsBooleanMethod · 0.45
GetConstantMethod · 0.45
IsTypedPrimitiveMethod · 0.45
GetUnderlyingTypeMethod · 0.45
ToTypeInstanceMethod · 0.45

Tested by

no test coverage detected