Skip to content

Commit 0c58a89

Browse files
authored
Merge pull request #6806 from diffblue/division
convenience methods for division expressions
2 parents 3e6b25b + 5e46184 commit 0c58a89

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

src/util/std_expr.h

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1171,6 +1171,30 @@ class mod_exprt:public binary_exprt
11711171
: binary_exprt(std::move(_lhs), ID_mod, std::move(_rhs))
11721172
{
11731173
}
1174+
1175+
/// The dividend of a division is the number that is being divided
1176+
exprt &dividend()
1177+
{
1178+
return op0();
1179+
}
1180+
1181+
/// The dividend of a division is the number that is being divided
1182+
const exprt &dividend() const
1183+
{
1184+
return op0();
1185+
}
1186+
1187+
/// The divisor of a division is the number the dividend is being divided by
1188+
exprt &divisor()
1189+
{
1190+
return op1();
1191+
}
1192+
1193+
/// The divisor of a division is the number the dividend is being divided by
1194+
const exprt &divisor() const
1195+
{
1196+
return op1();
1197+
}
11741198
};
11751199

11761200
template <>
@@ -1215,6 +1239,30 @@ class euclidean_mod_exprt : public binary_exprt
12151239
: binary_exprt(std::move(_lhs), ID_euclidean_mod, std::move(_rhs))
12161240
{
12171241
}
1242+
1243+
/// The dividend of a division is the number that is being divided
1244+
exprt &dividend()
1245+
{
1246+
return op0();
1247+
}
1248+
1249+
/// The dividend of a division is the number that is being divided
1250+
const exprt &dividend() const
1251+
{
1252+
return op0();
1253+
}
1254+
1255+
/// The divisor of a division is the number the dividend is being divided by
1256+
exprt &divisor()
1257+
{
1258+
return op1();
1259+
}
1260+
1261+
/// The divisor of a division is the number the dividend is being divided by
1262+
const exprt &divisor() const
1263+
{
1264+
return op1();
1265+
}
12181266
};
12191267

12201268
template <>

0 commit comments

Comments
 (0)