fix random range issue

This commit is contained in:
Alex Groce 2019-01-03 00:30:28 -07:00
parent 8a5d681c16
commit 1247ac64a2
2 changed files with 8 additions and 1 deletions

View File

@ -49,7 +49,7 @@
#define check DeepState_Check
#ifdef DEEPSTATE_TAKEOVER_RAND
#define rand DeepState_Int
#define rand DeepState_RandInt
#define srand DeepState_Warn_srand
#endif
@ -96,6 +96,7 @@ extern uint64_t DeepState_UInt64(void);
extern int64_t DeepState_Int64(void);
extern uint32_t DeepState_UInt(void);
extern int32_t DeepState_Int(void);
extern int32_t DeepState_RandInt(void);
extern uint16_t DeepState_UShort(void);
extern int16_t DeepState_Short(void);
extern uint8_t DeepState_UChar(void);

View File

@ -23,8 +23,10 @@
#include <setjmp.h>
#include <stdio.h>
#ifdef DEEPSTATE_TAKEOVER_RAND
#undef rand
#undef srand
#endif
DEEPSTATE_BEGIN_EXTERN_C
@ -289,6 +291,10 @@ int8_t DeepState_Char(void) {
#undef MAKE_SYMBOL_FUNC
int32_t DeepState_RandInt() {
return DeepState_IntInRange(0, RAND_MAX);
}
/* Returns the minimum satisfiable value for a given symbolic value, given
* the constraints present on that value. */
uint32_t DeepState_MinUInt(uint32_t v) {