Added a maximize objective API to DeepState.

This commit is contained in:
Peter Goodman
2017-12-10 13:37:47 -05:00
parent 188d4517d8
commit fcd000dc14
6 changed files with 68 additions and 15 deletions
+13 -1
View File
@@ -204,9 +204,21 @@ uint32_t DeepState_MinUInt(uint32_t v) {
}
int32_t DeepState_MinInt(int32_t v) {
return (int32_t) (DeepState_MinUInt(((uint32_t) v) + 0x80000000U) -
0x80000000U);
}
/* Returns the maximum satisfiable value for a given symbolic value, given
* the constraints present on that value. */
uint32_t DeepState_MaxUInt(uint32_t v) {
return v;
}
int32_t DeepState_MaxInt(int32_t v) {
return (int32_t) (DeepState_MaxUInt(((uint32_t) v) + 0x80000000U) -
0x80000000U);
}
void _DeepState_Assume(int expr, const char *expr_str, const char *file,
unsigned line) {
if (!expr) {
@@ -263,7 +275,7 @@ const struct DeepState_IndexEntry DeepState_API[] = {
{"ConcretizeData", (void *) DeepState_ConcretizeData},
{"ConcretizeCStr", (void *) DeepState_ConcretizeCStr},
{"MinUInt", (void *) DeepState_MinUInt},
{"MinInt", (void *) DeepState_MinInt},
{"MaxUInt", (void *) DeepState_MaxUInt},
/* Logging API. */
{"Log", (void *) DeepState_Log},