roseFlushLastByteHistory: iter state on stack

This commit is contained in:
Justin Viiret 2016-01-04 13:42:21 +11:00 committed by Matthew Barr
parent b2a76e6e2b
commit 09319940bf

View File

@ -268,8 +268,6 @@ void update_depth(struct RoseContext *tctxt, u8 depth) {
tctxt->depth = d; tctxt->depth = d;
} }
/* Note: uses the stashed sparse iter state; cannot be called from
* anybody else who is using it */
static rose_inline static rose_inline
void roseFlushLastByteHistory(const struct RoseEngine *t, u8 *state, void roseFlushLastByteHistory(const struct RoseEngine *t, u8 *state,
u64a currEnd, struct RoseContext *tctxt) { u64a currEnd, struct RoseContext *tctxt) {
@ -289,13 +287,16 @@ void roseFlushLastByteHistory(const struct RoseEngine *t, u8 *state,
DEBUG_PRINTF("flushing\n"); DEBUG_PRINTF("flushing\n");
const struct mmbit_sparse_iter *it const struct mmbit_sparse_iter *it =
= (const void *)((const char *)t + t->lastByteHistoryIterOffset); getByOffset(t, t->lastByteHistoryIterOffset);
assert(ISALIGNED(it));
const u32 numStates = t->rolesWithStateCount; const u32 numStates = t->rolesWithStateCount;
void *role_state = getRoleState(state); void *role_state = getRoleState(state);
mmbit_sparse_iter_unset(role_state, numStates, it, struct mmbit_sparse_state si_state[MAX_SPARSE_ITER_STATES];
scratch->sparse_iter_state);
mmbit_sparse_iter_unset(role_state, numStates, it, si_state);
} }
#endif #endif