From 19b606be8e26a6c259a3bd59440a1dff2a79273e Mon Sep 17 00:00:00 2001 From: Alex Groce Date: Sun, 9 Dec 2018 11:34:47 -0700 Subject: [PATCH] Fix ranges (C modulo can be negative) --- src/include/deepstate/DeepState.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/include/deepstate/DeepState.h b/src/include/deepstate/DeepState.h index 2059824..163d921 100644 --- a/src/include/deepstate/DeepState.h +++ b/src/include/deepstate/DeepState.h @@ -272,7 +272,7 @@ DEEPSTATE_INLINE static void DeepState_Check(int expr) { } \ if ((x < low) || (x > high)) { \ const tname size = (high - low) + 1; \ - return low + (x % size); \ + return low + ((x % size + size) % size); \ } \ return x; \ }