MCPcopy Create free account
hub / github.com/csmith-project/csmith / equals

Method equals

src/FunctionInvocationBinary.cpp:168–188  ·  view source on GitHub ↗

do some constant folding */

Source from the content-addressed store, hash-verified

166
167/* do some constant folding */
168bool
169FunctionInvocationBinary::equals(int num) const
170{
171 assert(param_value.size() == 2);
172 if (num == 0) {
173 if (param_value[0]->equals(0) &&
174 (eFunc==eMul || eFunc==eDiv || eFunc==eMod || eFunc==eLShift || eFunc==eRShift || eFunc==eAnd || eFunc==eBitAnd)) {
175 return true;
176 }
177 if (param_value[1]->equals(0) && (eFunc==eMul || eFunc==eAnd || eFunc==eBitAnd)) {
178 return true;
179 }
180 if (param_value[0] == param_value[1] && (eFunc==eSub || eFunc==eCmpGt || eFunc==eCmpLt || eFunc==eCmpNe)) {
181 return true;
182 }
183 if ((param_value[1]->equals(1) || param_value[1]->equals(-1)) && eFunc==eMod) {
184 return true;
185 }
186 }
187 return false;
188}
189
190bool
191FunctionInvocationBinary::is_0_or_1(void) const

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.80

Tested by

no test coverage detected