rose: define invalid value for program offset

This commit is contained in:
Justin Viiret 2017-02-01 10:41:32 +11:00 committed by Matthew Barr
parent ebe12797e6
commit a4af801dd1
3 changed files with 8 additions and 2 deletions

View File

@ -41,6 +41,7 @@
#include "miracle.h"
#include "report.h"
#include "rose.h"
#include "rose_common.h"
#include "rose_internal.h"
#include "rose_program.h"
#include "rose_types.h"
@ -1501,6 +1502,7 @@ hwlmcb_rv_t roseRunProgram_i(const struct RoseEngine *t,
DEBUG_PRINTF("program=%u, offsets [%llu,%llu], flags=%u\n", programOffset,
som, end, prog_flags);
assert(programOffset != ROSE_INVALID_PROG_OFFSET);
assert(programOffset >= sizeof(struct RoseEngine));
assert(programOffset < t->size);

View File

@ -31,6 +31,7 @@
#include "rose_build.h"
#include "rose_build_util.h"
#include "rose_common.h"
#include "rose_graph.h"
#include "nfa/mpvcompile.h"
#include "nfa/goughcompile.h"
@ -441,8 +442,8 @@ struct LitFragment {
: fragment_id(fragment_id_in), groups(groups_in) {}
u32 fragment_id;
rose_group groups;
u32 lit_program_offset = 0;
u32 delay_program_offset = 0;
u32 lit_program_offset = ROSE_INVALID_PROG_OFFSET;
u32 delay_program_offset = ROSE_INVALID_PROG_OFFSET;
};
// Concrete impl class

View File

@ -41,4 +41,7 @@
/** \brief Length in bytes of a reach bitvector, used by the lookaround code. */
#define REACH_BITVECTOR_LEN 32
/** \brief Value used to represent an invalid Rose program offset. */
#define ROSE_INVALID_PROG_OFFSET 0
#endif // ROSE_COMMON_H