MCPcopy Create free account
hub / github.com/anjo76/angelscript / InstrSHORT_B

Method InstrSHORT_B

sdk/angelscript/source/as_bytecode.cpp:2620–2646  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2618}
2619
2620int asCByteCode::InstrSHORT_B(asEBCInstr bc, short a, asBYTE b)
2621{
2622 asASSERT(asBCInfo[bc].type == asBCTYPE_wW_DW_ARG ||
2623 asBCInfo[bc].type == asBCTYPE_rW_DW_ARG ||
2624 asBCInfo[bc].type == asBCTYPE_W_DW_ARG);
2625 asASSERT(asBCInfo[bc].stackInc == 0);
2626
2627 if( AddInstruction() < 0 )
2628 return 0;
2629
2630 last->op = bc;
2631 last->wArg[0] = a;
2632
2633 // We'll have to be careful to store the byte correctly, independent of endianess.
2634 // Some optimizing compilers may change the order of operations, so we make sure
2635 // the value is not overwritten even if that happens.
2636 asBYTE *argPtr = (asBYTE*)ARG_DW(last->arg);
2637 argPtr[0] = b; // The value is always stored in the lower byte
2638 argPtr[1] = 0; // and clear the rest of the DWORD
2639 argPtr[2] = 0;
2640 argPtr[3] = 0;
2641
2642 last->size = asBCTypeSize[asBCInfo[bc].type];
2643 last->stackInc = asBCInfo[bc].stackInc;
2644
2645 return last->stackInc;
2646}
2647
2648int asCByteCode::InstrSHORT_W(asEBCInstr bc, short a, asWORD b)
2649{

Callers 2

ConvertToVariableMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected