MCPcopy Create free account
hub / github.com/WheretIB/nullc / ConvertFirstForSecond

Function ConvertFirstForSecond

NULLC/SyntaxTree.cpp:25–43  ·  view source on GitHub ↗

This function converts a type according to result type of binary operation between types 'first' and 'second' For example, int * double = double, so first operand will be transformed to double double * int = double, no transformations

Source from the content-addressed store, hash-verified

23//For example, int * double = double, so first operand will be transformed to double
24// double * int = double, no transformations
25asmStackType ConvertFirstForSecond(asmStackType first, asmStackType second)
26{
27 if(first == STYPE_INT && second == STYPE_DOUBLE)
28 {
29 cmdList.push_back(VMCmd(cmdItoD));
30 return second;
31 }
32 if(first == STYPE_LONG && second == STYPE_DOUBLE)
33 {
34 cmdList.push_back(VMCmd(cmdLtoD));
35 return second;
36 }
37 if(first == STYPE_INT && second == STYPE_LONG)
38 {
39 cmdList.push_back(VMCmd(cmdItoL));
40 return second;
41 }
42 return first;
43}
44
45//This functions transforms first type to second one
46void ConvertFirstToSecond(asmStackType first, asmStackType second)

Callers 1

CompileMethod · 0.70

Calls 2

VMCmdClass · 0.85
push_backMethod · 0.45

Tested by

no test coverage detected