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

Method AssignOpsProbability

src/StatementAssign.cpp:88–109  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88eAssignOps
89StatementAssign::AssignOpsProbability(const Type* type)
90{
91 if (!CGOptions::compound_assignment()) {
92 return eSimpleAssign;
93 }
94 // First, floating point values do not apply to |=, &= and ^=.
95 // Second, similar to signed integers, we don't generate pre- or post-
96 // operators for floating point values. Instead, we will wrap all
97 // of these operations into safe_float_math later.
98 if (type && (type->eType != eSimple || type->get_base_type()->is_float())) {
99 return eSimpleAssign;
100 }
101
102 VectorFilter filter(&assignOpsTable_);
103 if (type && type->is_signed()) {
104 filter.add(ePreIncr).add(ePreDecr).add(ePostIncr).add(ePostDecr);
105 }
106
107 int value = rnd_upto(filter.get_max_prob(), &filter);
108 return (eAssignOps)(filter.lookup(value));
109}
110
111/*
112 *

Callers

nothing calls this directly

Calls 6

rnd_uptoFunction · 0.85
is_floatMethod · 0.80
get_base_typeMethod · 0.80
is_signedMethod · 0.80
get_max_probMethod · 0.80
lookupMethod · 0.80

Tested by

no test coverage detected