MCPcopy Create free account
hub / github.com/ZDoom/gzdoom / CheckForCustomAddition

Function CheckForCustomAddition

src/scripting/backend/codegen_doom.cpp:162–173  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160//==========================================================================
161
162static bool CheckForCustomAddition(FxAddSub *func, FCompileContext &ctx)
163{
164 if (func->left->ValueType == TypeState && func->right->IsInteger() && func->Operator == '+' && !func->left->isConstant())
165 {
166 // This is the only special case of pointer addition that will be accepted - because it is used quite often in the existing game code.
167 func->ValueType = TypeState;
168 func->right = new FxMulDiv('*', func->right, new FxConstant((int)sizeof(FState), func->ScriptPosition)); // multiply by size here, so that constants can be better optimized.
169 func->right = func->right->Resolve(ctx);
170 return true;
171 }
172 return false;
173}
174
175//==========================================================================
176//

Callers

nothing calls this directly

Calls 3

IsIntegerMethod · 0.80
isConstantMethod · 0.45
ResolveMethod · 0.45

Tested by

no test coverage detected